webpack.config.prod.js 892 B

1234567891011121314151617181920212223242526272829303132
  1. const webpack = require('webpack')
  2. const merge = require('webpack-merge')
  3. const base = require('./webpack.config')
  4. module.exports = merge(base, {
  5. // Enable a full source map.
  6. devtool: 'source-map',
  7. output: {
  8. // Overwrite the default filename to include the chunkhash. This versions
  9. // the output files so that they can be cached (and cache-busted when they
  10. // change)
  11. filename: '[name]-[chunkhash].js'
  12. },
  13. plugins: [
  14. // Use UglifyJS to minimise output
  15. new webpack.optimize.UglifyJsPlugin({
  16. // Enable compression (options here are UglifyJS options)
  17. compress: {
  18. drop_console: true, // Remove console logs
  19. warnings: false // Silence Uglify warnings
  20. },
  21. output: {
  22. comments: false // Remove comments
  23. },
  24. // Prevent source map files from being stripped out of bundle
  25. sourceMap: true
  26. })
  27. ]
  28. })