webpack.dev.config.js
915 Bytes
const webpack = require('webpack');
const merge = require('webpack-merge');
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const devInfo = require('./dev-info.js');
let baseConfig = require('./webpack.base.config.js');
baseConfig = baseConfig('dev');
// https 环境不支持自动刷新
if (devInfo.publicPath.indexOf('https')) {
const path = require('path');
Object.keys(baseConfig.entry).forEach(function(name) {
baseConfig.entry[name] = [path.join(__dirname, './dev-client.js')].concat(baseConfig.entry[name]);
});
}
module.exports = merge(baseConfig, {
output: {
publicPath: devInfo.publicPath
},
devtool: 'source-map',
plugins: [
new ExtractTextPlugin('[name].css'),
new webpack.HotModuleReplacementPlugin(),
new FriendlyErrorsPlugin()
]
});