webpack.dev.conf.js
1.14 KB
const webpack = require('webpack');
const path = require('path');
const merge = require('webpack-merge');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
const baseConfig = require('./webpack.base.conf.js');
const config = require('./config');
const utils = require('./utils');
Object.keys(baseConfig.entry).forEach(function(name) {
baseConfig.entry[name] = ['webpack-hot-middleware/client?noInfo=true&reload=true'].concat(baseConfig.entry[name]);
});
module.exports = merge(baseConfig, {
module: {
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap }),
},
devtool: 'cheap-module-eval-source-map',
plugins: [
new webpack.DefinePlugin({
'process.env': config.dev.env,
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new HtmlWebpackPlugin({
filename: 'index.html',
template: './index.html',
inject: true,
}),
new FriendlyErrorsPlugin(),
],
});