Commit d3720ca0 authored by NGPixel's avatar NGPixel

refactor: added bundle analyzer

parent 1c8f3e4b
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
"stop": "node wiki stop", "stop": "node wiki stop",
"restart": "node wiki restart", "restart": "node wiki restart",
"build": "poi build", "build": "poi build",
"build:analyze": "poi build --analyze",
"dev:client": "poi watch", "dev:client": "poi watch",
"dev:server": "nodemon", "dev:server": "nodemon",
"dev:server:alt": "node-dev server --no-deps --respawn --no-notify", "dev:server:alt": "node-dev server --no-deps --respawn --no-notify",
...@@ -190,6 +191,7 @@ ...@@ -190,6 +191,7 @@
"vue-template-es2015-compiler": "1.6.0", "vue-template-es2015-compiler": "1.6.0",
"vuex": "3.0.1", "vuex": "3.0.1",
"vuex-persistedstate": "2.4.2", "vuex-persistedstate": "2.4.2",
"webpack-bundle-analyzer": "2.9.2",
"whatwg-fetch": "2.0.3" "whatwg-fetch": "2.0.3"
}, },
"jest": { "jest": {
......
const path = require('path') const path = require('path')
const _ = require('lodash') const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
const SpriteLoaderPlugin = require('svg-sprite-loader/plugin') // const _ = require('lodash')
// const SpriteLoaderPlugin = require('svg-sprite-loader/plugin')
module.exports = { module.exports = options => ({
entry: 'client/index.js', entry: 'client/index.js',
dist: 'assets', dist: 'assets',
staticFolder: 'client/static', staticFolder: 'client/static',
...@@ -27,7 +28,7 @@ module.exports = { ...@@ -27,7 +28,7 @@ module.exports = {
}, },
html: false, html: false,
hash: false, hash: false,
sourceMap: true, sourceMap: false,
extendWebpack (config) { extendWebpack (config) {
// Vue - Default SCSS Imports // Vue - Default SCSS Imports
config.module.rule('vue') config.module.rule('vue')
...@@ -68,8 +69,15 @@ module.exports = { ...@@ -68,8 +69,15 @@ module.exports = {
// Vue with Compiler Alias // Vue with Compiler Alias
config.resolve.alias.set('vue$', 'vue/dist/vue.common.js') config.resolve.alias.set('vue$', 'vue/dist/vue.common.js')
// Bundle Analyze
if (options.analyze) {
config.plugin('analyzer').use(BundleAnalyzerPlugin, [{
analyzerMode: 'static'
}])
}
}, },
webpack (config) { webpack (config) {
return config return config
} }
} })
This diff was suppressed by a .gitattributes entry.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment