refactor: added bundle analyzer
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
"stop": "node wiki stop",
|
||||
"restart": "node wiki restart",
|
||||
"build": "poi build",
|
||||
"build:analyze": "poi build --analyze",
|
||||
"dev:client": "poi watch",
|
||||
"dev:server": "nodemon",
|
||||
"dev:server:alt": "node-dev server --no-deps --respawn --no-notify",
|
||||
@@ -190,6 +191,7 @@
|
||||
"vue-template-es2015-compiler": "1.6.0",
|
||||
"vuex": "3.0.1",
|
||||
"vuex-persistedstate": "2.4.2",
|
||||
"webpack-bundle-analyzer": "2.9.2",
|
||||
"whatwg-fetch": "2.0.3"
|
||||
},
|
||||
"jest": {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
const path = require('path')
|
||||
const _ = require('lodash')
|
||||
const SpriteLoaderPlugin = require('svg-sprite-loader/plugin')
|
||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
|
||||
// const _ = require('lodash')
|
||||
// const SpriteLoaderPlugin = require('svg-sprite-loader/plugin')
|
||||
|
||||
module.exports = {
|
||||
module.exports = options => ({
|
||||
entry: 'client/index.js',
|
||||
dist: 'assets',
|
||||
staticFolder: 'client/static',
|
||||
@@ -27,7 +28,7 @@ module.exports = {
|
||||
},
|
||||
html: false,
|
||||
hash: false,
|
||||
sourceMap: true,
|
||||
sourceMap: false,
|
||||
extendWebpack (config) {
|
||||
// Vue - Default SCSS Imports
|
||||
config.module.rule('vue')
|
||||
@@ -68,8 +69,15 @@ module.exports = {
|
||||
|
||||
// Vue with Compiler Alias
|
||||
config.resolve.alias.set('vue$', 'vue/dist/vue.common.js')
|
||||
|
||||
// Bundle Analyze
|
||||
if (options.analyze) {
|
||||
config.plugin('analyzer').use(BundleAnalyzerPlugin, [{
|
||||
analyzerMode: 'static'
|
||||
}])
|
||||
}
|
||||
},
|
||||
webpack (config) {
|
||||
return config
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user