Skip to content

Commit 99ab54a

Browse files
author
Guillaume Chau
committed
chore: upgrade to webpack 4 + don't minimize backend, closes #771
1 parent 43b9f50 commit 99ab54a

File tree

5 files changed

+2096
-1891
lines changed

5 files changed

+2096
-1891
lines changed

package.json

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"dev": "cross-env PORT=8100 npm run dev:shell",
88
"dev:shell": "cd shells/dev && webpack-dev-server --inline --hot --no-info",
9-
"dev:chrome": "cd shells/chrome && webpack --watch --hide-modules",
9+
"dev:chrome": "cd shells/chrome && cross-env NODE_ENV=production webpack --watch --hide-modules",
1010
"lint": "eslint src --ext=js,vue && eslint shells/chrome/src && eslint shells/dev/src && eslint shells/electron/src",
1111
"build": "cd shells/chrome && cross-env NODE_ENV=production webpack --progress --hide-modules",
1212
"run:firefox": "web-ext run -s shells/chrome -a dist -i src",
@@ -37,48 +37,49 @@
3737
"homepage": "https://github.com/vuejs/vue-devtools#readme",
3838
"dependencies": {
3939
"@vue/ui": "^0.5.6",
40-
"autoprefixer": "^9.0.2",
4140
"circular-json-es6": "^2.0.1",
42-
"d3": "^5.5.0",
41+
"d3": "^5.7.0",
4342
"lodash.debounce": "^4.0.8",
4443
"lodash.groupby": "^4.6.0",
4544
"lru-cache": "^4.1.3",
46-
"uglifyjs-webpack-plugin": "^1.1.4",
47-
"vue": "^2.5.13",
45+
"vue": "^2.5.17",
4846
"vue-router": "^3.0.1",
4947
"vue-virtual-scroller": "^0.12.0",
5048
"vuex": "^3.0.1"
5149
},
5250
"devDependencies": {
51+
"autoprefixer": "^9.1.5",
5352
"buble": "^0.19.0",
5453
"buble-loader": "^0.5.1",
55-
"cross-env": "^5.1.3",
56-
"css-loader": "^0.28.7",
57-
"cypress": "^3.0.2",
58-
"eslint": "^5.2.0",
54+
"cross-env": "^5.2.0",
55+
"css-loader": "^1.0.0",
56+
"cypress": "^3.1.0",
57+
"eslint": "^5.6.0",
5958
"eslint-config-standard": "^12.0.0",
6059
"eslint-plugin-cypress": "^2.0.1",
61-
"eslint-plugin-import": "^2.13.0",
60+
"eslint-plugin-import": "^2.14.0",
6261
"eslint-plugin-node": "^7.0.1",
6362
"eslint-plugin-promise": "^4.0.0",
6463
"eslint-plugin-standard": "^4.0.0",
6564
"eslint-plugin-vue": "^5.0.0-beta.3",
66-
"file-loader": "^1.1.6",
67-
"friendly-errors-webpack-plugin": "^1.6.1",
65+
"file-loader": "^2.0.0",
66+
"friendly-errors-webpack-plugin": "^1.7.0",
6867
"inquirer": "^6.2.0",
69-
"launch-editor-middleware": "^2.1.0",
70-
"postcss-loader": "^2.1.6",
68+
"launch-editor-middleware": "^2.2.1",
69+
"postcss-loader": "^3.0.0",
7170
"raw-loader": "^0.5.1",
72-
"semver": "^5.4.1",
73-
"start-server-and-test": "^1.5.0",
74-
"style-resources-loader": "^1.1.0",
71+
"semver": "^5.5.1",
72+
"start-server-and-test": "^1.7.1",
73+
"style-resources-loader": "^1.2.1",
7574
"stylus": "^0.54.5",
7675
"stylus-loader": "^3.0.1",
77-
"url-loader": "^0.6.2",
78-
"vue-loader": "^15.0.0-beta.1",
79-
"vue-template-compiler": "^2.5.13",
80-
"webpack": "^3.10.0",
81-
"webpack-dev-server": "^2.9.7",
76+
"uglifyjs-webpack-plugin": "^1.2.7",
77+
"url-loader": "^1.1.1",
78+
"vue-loader": "^15.4.2",
79+
"vue-template-compiler": "^2.5.17",
80+
"webpack": "^4.19.0",
81+
"webpack-cli": "^3.1.0",
82+
"webpack-dev-server": "^3.1.8",
8283
"webpack-merge": "^4.1.2"
8384
},
8485
"engines": {

shells/createConfig.js

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module.exports = (config, target = { chrome: 52, firefox: 48 }) => {
1515
}
1616

1717
const baseConfig = {
18+
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
1819
resolve: {
1920
alias: {
2021
src: path.resolve(__dirname, '../src'),
@@ -84,6 +85,9 @@ module.exports = (config, target = { chrome: 52, firefox: 48 }) => {
8485
],
8586
devServer: {
8687
port: process.env.PORT
88+
},
89+
stats: {
90+
colors: true
8791
}
8892
}
8993

@@ -92,9 +96,54 @@ module.exports = (config, target = { chrome: 52, firefox: 48 }) => {
9296
baseConfig.plugins.push(
9397
new webpack.DefinePlugin({
9498
'process.env.NODE_ENV': '"production"'
95-
}),
96-
new UglifyPlugin()
99+
})
97100
)
101+
baseConfig.optimization = {
102+
minimizer: [
103+
new UglifyPlugin({
104+
exclude: /backend/,
105+
uglifyOptions: {
106+
compress: {
107+
// turn off flags with small gains to speed up minification
108+
arrows: false,
109+
collapse_vars: false, // 0.3kb
110+
comparisons: false,
111+
computed_props: false,
112+
hoist_funs: false,
113+
hoist_props: false,
114+
hoist_vars: false,
115+
inline: false,
116+
loops: false,
117+
negate_iife: false,
118+
properties: false,
119+
reduce_funcs: false,
120+
reduce_vars: false,
121+
switches: false,
122+
toplevel: false,
123+
typeofs: false,
124+
125+
// a few flags with noticable gains/speed ratio
126+
// numbers based on out of the box vendor bundle
127+
booleans: true, // 0.7kb
128+
if_return: true, // 0.4kb
129+
sequences: true, // 0.7kb
130+
unused: true, // 2.3kb
131+
132+
// required features to drop conditional branches
133+
conditionals: true,
134+
dead_code: true,
135+
evaluate: true
136+
},
137+
mangle: {
138+
safari10: true
139+
}
140+
},
141+
sourceMap: false,
142+
cache: true,
143+
parallel: true
144+
})
145+
]
146+
}
98147
}
99148

100149
return merge(baseConfig, config)

shells/electron/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"start": "node bin.js",
1515
"dev": "webpack --watch --hide-modules",
1616
"build": "webpack",
17-
"prepare": "npm run build"
17+
"prepublishOnly": "npm run build"
1818
},
1919
"author": "",
2020
"license": "MIT",
@@ -26,6 +26,7 @@
2626
"socket.io": "^2.0.4"
2727
},
2828
"devDependencies": {
29-
"webpack": "^3.10.0"
29+
"webpack": "^4.19.0",
30+
"webpack-cli": "^3.1.0"
3031
}
3132
}

0 commit comments

Comments
 (0)