webpack.dev.config.js 1.19 KB
'use strict';

const path = require('path');
const _ = require('lodash');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const devInfo = require('./dev-info.js');
let baseConfig = require('./webpack.base.config.js');

baseConfig = baseConfig('dev');

_.mergeWith(baseConfig, {
    devtool: '#cheap-module-source-map',
    output: {
        publicPath: devInfo.publicPath
    },
    devServer: {
        host: '127.0.0.1',
        port: devInfo.port,
        publicPath: devInfo.publicPath,
        contentBase: [path.join(__dirname, './bundle/'), path.join(__dirname, '../')],
        hot: true,
        inline: true,
        compress: true,
        stats: {
            colors: true,
            children: false,
            chunks: false,
            assetsSort: 'size'
        },
        headers: {
            'Access-Control-Allow-Origin': '*'
        }
    },
    plugins: [
        new ExtractTextPlugin('[name].css'),
        new webpack.HotModuleReplacementPlugin()
    ]
}, function customizer(objValue, srcValue) {
    if (_.isArray(objValue)) {
        return objValue.concat(srcValue);
    }
});

delete baseConfig.extends;

module.exports = baseConfig;