...
 
Commits (2)
......@@ -8,16 +8,44 @@ const isCoverage = process.env.npm_lifecycle_event && process.env.npm_lifecycle_
const isUnitTesting = process.env.npm_lifecycle_event && process.env.npm_lifecycle_event === 'test:unit'
const isE2ETesting = process.env.npm_lifecycle_event && process.env.npm_lifecycle_event === 'test:e2e'
const chunks = {
vue: {
test: /[\/\\]node_modules[\/\\]\@?vue[\/\\]/,
enforce: true,
name: 'vue'
},
elementui: {
test: /[\/\\]node_modules[\/\\]element-ui[\/\\]/,
name: 'elementui'
},
fontawesome: {
test: /[\/\\]node_modules[\/\\]\@fortawesome[\/\\]/,
enforce: true,
name: 'fontawesome'
},
lodash: {
test: /[\/\\]node_modules[\/\\]lodash[\/\\]/,
name: 'lodash'
},
vendor: {
test: /[\/\\]node_modules[\/\\]/,
priority: -10,
name: 'vendor'
}
}
module.exports = {
pages: {
index: {
entry: 'src/index.js',
template: 'src/index.html',
title: 'salp'
title: 'salp',
chunks: Object.keys(chunks).map(key => chunks[key].name || key).concat('index')
},
about: {
entry: 'src/about.js',
template: 'src/about.html'
template: 'src/about.html',
chunks: ['vue', 'elementui', 'vendor', 'about']
}
},
chainWebpack: config => {
......@@ -87,6 +115,15 @@ module.exports = {
})
}
if (!isTesting) {
// Create chunks for (larger) libraries
config.optimization.splitChunks({
chunks: 'all',
cacheGroups: chunks
})
config.output.chunkFilename('js/[name].chunk.js')
}
if (process.env.IS_REMOTE_DEBUG) {
config.devtool('source-map')
}
......