Skip to content

Commit

Permalink
[enhancement]Remove useless files and performance enhancement in dev …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
SidKwok authored and LinusBorg committed Nov 16, 2017
1 parent d6ba474 commit 9aeb427
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ module.exports = {
".eslintrc.js": "lint",
".eslintignore": "lint",
"config/test.env.js": "unit || e2e",
"build/webpack.test.conf.js": "e2e || (unit && runner === 'karma')",
"test/unit/**/*": "unit",
"test/unit/index.js": "unit && runner === 'karma'",
"test/unit/karma.conf.js": "unit && runner === 'karma'",
Expand Down
7 changes: 3 additions & 4 deletions template/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
}],
"stage-2"
],
"plugins": ["transform-runtime"],
"plugins": ["transform-runtime"]{{#if_or unit e2e}},
"env": {
"test": {
"presets": ["env", "stage-2"]{{#if_eq runner "karma"}},
"plugins": ["istanbul"]
{{/if_eq}}
"plugins": ["istanbul"]{{/if_eq}}
}
}
}{{/if_or}}
}
5 changes: 3 additions & 2 deletions template/build/webpack.dev.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ const devWebpackConfig = merge(baseWebpackConfig, {
},
// cheap-module-eval-source-map is faster for development
devtool: config.dev.devtool,

// these devServer options should be customized in /config/index.js
devServer: {
clientLogLevel: 'warning',
historyApiFallback: true,
hot: true,
compress: true,
host: process.env.HOST || config.dev.host,
port: process.env.PORT || config.dev.port,
open: config.dev.autoOpenBrowser,
Expand All @@ -37,7 +38,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
plugins: [
new webpack.DefinePlugin({
'process.env': require('../config/dev.env')
}),
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
new webpack.NoEmitOnErrorsPlugin(),
Expand Down
8 changes: 4 additions & 4 deletions template/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {

// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.HOST, if port is in use, a free one will be determined
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,
notifyOnErrors: true,
Expand Down Expand Up @@ -47,7 +47,7 @@ module.exports = {
// just be aware of this issue when enabling this option.
cssSourceMap: false,
},

build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
Expand All @@ -64,14 +64,14 @@ module.exports = {
productionSourceMap: true,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',

// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],

// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
Expand Down

0 comments on commit 9aeb427

Please sign in to comment.