webpack.prod.js 953 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. var merge = require('webpack-merge')
  2. var webpack = require('webpack')
  3. var path = require('path')
  4. var common = require('./webpack.common.js')
  5. var Visualizer = require('webpack-visualizer-plugin')
  6. var Cleaner = require('clean-webpack-plugin')
  7. var pathsToClean = [
  8. 'dist/**',
  9. 'build/**'
  10. ]
  11. module.exports = merge(common, {
  12. output: {
  13. filename: '[name].min.js',
  14. path: path.resolve(__dirname, 'build')
  15. },
  16. mode: 'production',
  17. optimization: {
  18. minimize: true,
  19. splitChunks: {
  20. chunks: 'all',
  21. name: false
  22. }
  23. },
  24. plugins: [
  25. // build optimization plugins
  26. new webpack.LoaderOptionsPlugin({
  27. minimize: true,
  28. debug: true
  29. }),
  30. new Visualizer({
  31. path: path.resolve(__dirname, 'build'),
  32. filename: './statistics.html'
  33. }),
  34. new Cleaner(pathsToClean, {verbose: true, dry: false})
  35. ]
  36. })