admin-fe/build/webpack.dev.conf.js

47 lines
1.4 KiB
JavaScript
Raw Normal View History

2017-04-18 07:09:13 +00:00
var utils = require('./utils')
var path = require('path')
var webpack = require('webpack')
var config = require('../config')
var merge = require('webpack-merge')
var baseWebpackConfig = require('./webpack.base.conf')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
// add hot-reload related code to entry chunks
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
2017-08-07 08:11:10 +00:00
baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
2017-04-18 07:09:13 +00:00
})
function resolveApp(relativePath) {
2017-08-07 08:11:10 +00:00
return path.resolve(relativePath);
2017-04-18 07:09:13 +00:00
}
module.exports = merge(baseWebpackConfig, {
2017-08-07 08:11:10 +00:00
module: {
rules: utils.styleLoaders({
sourceMap: config.dev.cssSourceMap
})
},
// cheap-source-map is faster for development
devtool: '#cheap-source-map',
cache: true,
plugins: [
new webpack.DefinePlugin({
'process.env': config.dev.env
}),
// https://github.com/glenjamin/webpack-hot-middleware#installation--usage
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
favicon: resolveApp('favicon.ico'),
inject: true,
path: config.dev.assetsPublicPath + config.dev.assetsSubDirectory
}),
new FriendlyErrorsPlugin()
]
2017-04-18 07:09:13 +00:00
})
2017-08-07 08:11:10 +00:00