'use strict'
const exec = require('child_process').execSync
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const ProgressBarPlugin = require('progress-bar-webpack-plugin')

const base = require('./webpack.base')
const config = require('./config')

exec('rm -rf dist/')

const extractCSS = new ExtractTextPlugin('[name].css')

base.entry.vendor = config.vendor
base.output.filename = '[name].[chunkhash:8].js'

// Plugins Configuration
base.plugins.push(
  new ProgressBarPlugin(),
  new ExtractTextPlugin('styles.[contenthash:8].css'),
  new webpack.DefinePlugin({
    'process.env.NODE_ENV': JSON.stringify('production')
  }),
  new webpack.optimize.UglifyJsPlugin({
    compress: {
      warnings: false
    },
    output: {
      comments: false
    }
  }),
  new webpack.optimize.CommonsChunkPlugin({
    name: 'vendor',
    filename: 'vendor.[chunkhash:8].js'
  }),
  new webpack.LoaderOptionsPlugin({
    minimize: true,
    options: {
      postcss: config.postcss
    }
  })
)

base.module.rules.push(
  {
    test: /\.css$/,
    loader: extractCSS.extract(['css-loader?modules&localIdentName=[name]__[local]___[hash:base64:5]', 'postcss-loader']),
    exclude: /node_modules/
  },
  {
    test: /\.css$/,
    loader: extractCSS.extract(['css-loader?modules&localIdentName=[name]__[local]___[hash:base64:5]', 'postcss-loader']),
    include: /node_modules/
  },
  {
    test: /\.less$/,
    loader: extractCSS.extract(['css-loader', 'less-loader'])
  }
)
base.plugins.push(
  extractCSS
)

module.exports = base

'use strict'
const exec = require('child_process').execSync
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const ProgressBarPlugin = require('progress-bar-webpack-plugin')

const base = require('./webpack.base')
const config = require('./config')

exec('rm -rf dist/')

const extractCSS = new ExtractTextPlugin('[name].css')

base.entry.vendor = config.vendor
base.output.filename = '[name].[chunkhash:8].js'

// Plugins Configuration
base.plugins.push(
  new ProgressBarPlugin(),
  new ExtractTextPlugin('styles.[contenthash:8].css'),
  new webpack.DefinePlugin({
    'process.env.NODE_ENV': JSON.stringify('production')
  }),
  new webpack.optimize.UglifyJsPlugin({
    compress: {
      warnings: false
    },
    output: {
      comments: false
    }
  }),
  new webpack.optimize.CommonsChunkPlugin({
    name: 'vendor',
    filename: 'vendor.[chunkhash:8].js'
  }),
  new webpack.LoaderOptionsPlugin({
    minimize: true,
    options: {
      postcss: config.postcss
    }
  })
)

base.module.rules.push(
  {
    test: /\.css$/,
    loader: extractCSS.extract(['css-loader?modules&localIdentName=[name]__[local]___[hash:base64:5]', 'postcss-loader']),
    exclude: /node_modules/
  },
  {
    test: /\.css$/,
    loader: extractCSS.extract(['css-loader', 'postcss-loader']),
    include: /node_modules/
  },
  {
    test: /\.less$/,
    loader: extractCSS.extract(['css-loader', 'less-loader'])
  }
)
base.plugins.push(
  extractCSS
)

module.exports = base

Update webpack.prod.js