webpack.prod.js 651 B

123456789101112131415161718192021222324
  1. const webpack = require('webpack')
  2. const merge = require('webpack-merge')
  3. const CleanWebpackPlugin = require('clean-webpack-plugin')
  4. const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
  5. const ExtractTextPlugin = require('extract-text-webpack-plugin')
  6. const common = require('./webpack.common.js')
  7. console.info(process.cwd())
  8. module.exports = merge(common, {
  9. module: {
  10. rules: []
  11. },
  12. plugins: [
  13. new CleanWebpackPlugin(['assets'], { root: process.cwd() }),
  14. new UglifyJSPlugin(),
  15. new webpack.DefinePlugin({
  16. 'process.env.NODE_ENV': JSON.stringify('production')
  17. }),
  18. new ExtractTextPlugin('css/bundle.css')
  19. ]
  20. })