Skip to content

Commit bf68f28

Browse files
SidKwokfrandiox
authored andcommitted
[enhancement]Remove useless files and performance enhancement in dev server. (vuejs-templates#1072)
* replace `id` with `name` in chunk files, Fix vuejs-templates#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 a1a1e84 commit bf68f28

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

meta.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ module.exports = {
8787
".eslintrc.js": "lint",
8888
".eslintignore": "lint",
8989
"config/test.env.js": "unit || e2e",
90+
"build/webpack.test.conf.js": "e2e || (unit && runner === 'karma')",
9091
"test/unit/**/*": "unit",
9192
"build/webpack.test.conf.js": "unit",
9293
"test/e2e/**/*": "e2e",

template/.babelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
}],
99
"stage-2"
1010
],
11-
"plugins": ["transform-runtime"],
11+
"plugins": ["transform-runtime"]{{#if_or unit e2e}},
1212
"env": {
1313
"test": {
1414
"presets": ["env", "stage-2"],
1515
"plugins": ["istanbul"]
1616
}
17-
}
17+
}{{/if_or}}
1818
}

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, '../www/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)