webpack.dev.conf.js 1.11 KB
let webpack = require('webpack');
var path = require('path');
let config = require('./config')
let utils = require('./utils');
let merge = require('webpack-merge')
let HtmlWebpackPlugin = require('html-webpack-plugin');
let baseConfig = require('./webpack.base.conf.js');
let FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')

const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');

Object.keys(baseConfig.entry).forEach(function (name) {
  baseConfig.entry[name] = ['./build/dev-client'].concat(baseConfig.entry[name])
})

module.exports = merge(baseConfig, {
    module: {
        rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
    },
    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(),
    ]
})