Skip to content
This repository was archived by the owner on Jun 14, 2018. It is now read-only.

Commit b0b52bb

Browse files
authored
Merge pull request vuejs-templates#426 from EGOIST-robot/patch-1
Add friendly-errors-webpack-plugin
2 parents aceb839 + 4363b3c commit b0b52bb

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

template/build/dev-server.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ var compiler = webpack(webpackConfig)
2121

2222
var devMiddleware = require('webpack-dev-middleware')(compiler, {
2323
publicPath: webpackConfig.output.publicPath,
24-
stats: {
25-
colors: true,
26-
chunks: false
27-
}
24+
quiet: true
2825
})
2926

30-
var hotMiddleware = require('webpack-hot-middleware')(compiler)
27+
var hotMiddleware = require('webpack-hot-middleware')(compiler, {
28+
log: () => {}
29+
})
3130
// force page reload when html-webpack-plugin template changes
3231
compiler.plugin('compilation', function (compilation) {
3332
compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
@@ -59,13 +58,17 @@ app.use(hotMiddleware)
5958
var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
6059
app.use(staticPath, express.static('./static'))
6160

61+
var uri = 'http://localhost:' + port
62+
63+
devMiddleware.waitUntilValid(function () {
64+
console.log('> Listening at ' + uri + '\n')
65+
})
66+
6267
module.exports = app.listen(port, function (err) {
6368
if (err) {
6469
console.log(err)
6570
return
6671
}
67-
var uri = 'http://localhost:' + port
68-
console.log('Listening at ' + uri + '\n')
6972

7073
// when env is testing, don't need open it
7174
if (process.env.NODE_ENV !== 'testing') {

template/build/webpack.dev.conf.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var merge = require('webpack-merge')
44
var utils = require('./utils')
55
var baseWebpackConfig = require('./webpack.base.conf')
66
var HtmlWebpackPlugin = require('html-webpack-plugin')
7+
var FriendlyErrors = require('friendly-errors-webpack-plugin')
78

89
// add hot-reload related code to entry chunks
910
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
@@ -29,6 +30,7 @@ module.exports = merge(baseWebpackConfig, {
2930
filename: 'index.html',
3031
template: 'index.html',
3132
inject: true
32-
})
33+
}),
34+
new FriendlyErrors()
3335
]
3436
})

template/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"express": "^4.13.3",
5050
"extract-text-webpack-plugin": "^1.0.1",
5151
"file-loader": "^0.9.0",
52+
"friendly-errors-webpack-plugin": "^1.1.2",
5253
"function-bind": "^1.0.2",
5354
"html-webpack-plugin": "^2.8.1",
5455
"http-proxy-middleware": "^0.17.2",

0 commit comments

Comments
 (0)