mirror of
https://github.com/desktop/desktop
synced 2024-10-31 11:07:25 +00:00
Split all codemirror modes into individual chunks
This commit is contained in:
parent
d20775f5ef
commit
6dc65d028e
1 changed files with 28 additions and 1 deletions
|
@ -148,7 +148,34 @@ const cliConfig = merge({}, commonConfig, {
|
|||
|
||||
const highlighterConfig = merge({}, commonConfig, {
|
||||
entry: { highlighter: path.resolve(__dirname, 'src/highlighter/index') },
|
||||
output: { libraryTarget: 'var' },
|
||||
output: {
|
||||
libraryTarget: 'var',
|
||||
chunkFilename: 'highlighter/[name].js',
|
||||
},
|
||||
optimization: {
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
modes: {
|
||||
enforce: true,
|
||||
name: (mod, chunks) => {
|
||||
const builtInMode = /node_modules\/codemirror\/mode\/(\w+)\//.exec(
|
||||
mod.resource
|
||||
)
|
||||
if (builtInMode) {
|
||||
return `mode/${builtInMode[1]}`
|
||||
}
|
||||
const external = /node_modules\/codemirror-mode-(\w+)\//.exec(
|
||||
mod.resource
|
||||
)
|
||||
if (external) {
|
||||
return `ext/${external[1]}`
|
||||
}
|
||||
return 'common'
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
target: 'webworker',
|
||||
plugins: [
|
||||
new webpack.DefinePlugin(
|
||||
|
|
Loading…
Reference in a new issue