Skip to content

Commit 472c561

Browse files
SidKwokLinusBorg
authored andcommitted
[enhancement]Remove useless files and performance enhancement in dev server. (#1072)
* replace `id` with `name` in chunk files, Fix #996 * fix typo * remove env in `.babelrc` when not using unit or e2e * remove `webpack.test.conf.js` when not using unit or e2e * remove extra space in `.babelrc` * enable `compress` in devServer by default * remove `webpack.test.conf.js` when not using unit(karma) or e2e
1 parent b366b83 commit 472c561

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

meta.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ module.exports = {
105105
".eslintrc.js": "lint",
106106
".eslintignore": "lint",
107107
"config/test.env.js": "unit || e2e",
108+
"build/webpack.test.conf.js": "e2e || (unit && runner === 'karma')",
108109
"test/unit/**/*": "unit",
109110
"test/unit/index.js": "unit && runner === 'karma'",
110111
"test/unit/karma.conf.js": "unit && runner === 'karma'",

template/.babelrc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
}],
66
"stage-2"
77
],
8-
"plugins": ["transform-runtime"],
8+
"plugins": ["transform-runtime"]{{#if_or unit e2e}},
99
"env": {
1010
"test": {
1111
"presets": ["env", "stage-2"]{{#if_eq runner "karma"}},
12-
"plugins": ["istanbul"]
13-
{{/if_eq}}
12+
"plugins": ["istanbul"]{{/if_eq}}
1413
}
15-
}
14+
}{{/if_or}}
1615
}

template/build/webpack.dev.conf.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ const devWebpackConfig = merge(baseWebpackConfig, {
1414
},
1515
// cheap-module-eval-source-map is faster for development
1616
devtool: config.dev.devtool,
17-
17+
1818
// these devServer options should be customized in /config/index.js
1919
devServer: {
2020
clientLogLevel: 'warning',
2121
historyApiFallback: true,
2222
hot: true,
23+
compress: true,
2324
host: process.env.HOST || config.dev.host,
2425
port: process.env.PORT || config.dev.port,
2526
open: config.dev.autoOpenBrowser,
@@ -37,7 +38,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
3738
plugins: [
3839
new webpack.DefinePlugin({
3940
'process.env': require('../config/dev.env')
40-
}),
41+
}),
4142
new webpack.HotModuleReplacementPlugin(),
4243
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
4344
new webpack.NoEmitOnErrorsPlugin(),

template/config/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = {
1414

1515
// Various Dev Server settings
1616
host: 'localhost', // can be overwritten by process.env.HOST
17-
port: 8080, // can be overwritten by process.env.HOST, if port is in use, a free one will be determined
17+
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
1818
autoOpenBrowser: false,
1919
errorOverlay: true,
2020
notifyOnErrors: true,
@@ -47,7 +47,7 @@ module.exports = {
4747
// just be aware of this issue when enabling this option.
4848
cssSourceMap: false,
4949
},
50-
50+
5151
build: {
5252
// Template for index.html
5353
index: path.resolve(__dirname, '../dist/index.html'),
@@ -64,14 +64,14 @@ module.exports = {
6464
productionSourceMap: true,
6565
// https://webpack.js.org/configuration/devtool/#production
6666
devtool: '#source-map',
67-
67+
6868
// Gzip off by default as many popular static hosts such as
6969
// Surge or Netlify already gzip all static assets for you.
7070
// Before setting to `true`, make sure to:
7171
// npm install --save-dev compression-webpack-plugin
7272
productionGzip: false,
7373
productionGzipExtensions: ['js', 'css'],
74-
74+
7575
// Run the build command with an extra argument to
7676
// View the bundle analyzer report after build finishes:
7777
// `npm run build --report`

0 commit comments

Comments
 (0)