mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-24 16:18:57 -06:00
39 lines
983 B
JavaScript
39 lines
983 B
JavaScript
const webpack = require('webpack')
|
|
const HTMLPlugin = require('html-webpack-plugin')
|
|
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
|
|
|
|
module.exports = api => {
|
|
api.chainWebpack(webpackConfig => {
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
webpackConfig
|
|
.devtool('cheap-module-source-map')
|
|
|
|
webpackConfig
|
|
.plugin('hmr')
|
|
.use(webpack.HotModuleReplacementPlugin)
|
|
|
|
webpackConfig
|
|
.plugin('named-modules')
|
|
.use(webpack.NamedModulesPlugin)
|
|
|
|
webpackConfig
|
|
.plugin('no-emit-on-errors')
|
|
.use(webpack.NoEmitOnErrorsPlugin)
|
|
|
|
// TODO WatchMissingNodeModulesPlugin
|
|
|
|
webpackConfig
|
|
.plugin('friendly-errors')
|
|
.use(FriendlyErrorsPlugin) // TODO port message?
|
|
|
|
// TODO InterpolateHtmlPlugin
|
|
|
|
webpackConfig
|
|
.plugin('html')
|
|
.use(HTMLPlugin, [{
|
|
template: api.resolve('public/index.html')
|
|
}])
|
|
}
|
|
})
|
|
}
|