webpack.prod.config.js 877 Bytes
'use strict';

const path = require('path');
const shelljs = require('shelljs');
const _ = require('lodash');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const config = require('../../package.json');
const distDir = path.join(__dirname, `../dist/${config.name}/${config.version}`);
let baseConfig = require('./webpack.base.config.js');

// cope img font
shelljs.mkdir('-p', distDir);
shelljs.cp('-R', path.join(__dirname, '../img/'), distDir);
shelljs.cp('-R', path.join(__dirname, '../font/'), distDir);

baseConfig = baseConfig('pro');

_.mergeWith(baseConfig, {
    mode: 'production',
    output: {
        path: distDir
    },
    plugins: [
        new ExtractTextPlugin('[name].css')
    ]
}, function customizer(objValue, srcValue) {
    if (_.isArray(objValue)) {
        return objValue.concat(srcValue);
    }
});

module.exports = baseConfig;