webpack.prod.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. library: 'opensheetmusicdisplay',
  16. libraryTarget: 'umd'
  17. },
  18. mode: 'production',
  19. optimization: {
  20. minimize: true
  21. // splitChunks: {
  22. // chunks: 'all',
  23. // name: false
  24. // }
  25. },
  26. plugins: [
  27. // build optimization plugins
  28. new webpack.LoaderOptionsPlugin({
  29. minimize: true,
  30. debug: true
  31. }),
  32. new Visualizer({
  33. path: path.resolve(__dirname, 'build'),
  34. filename: './statistics.html'
  35. }),
  36. new Cleaner(pathsToClean, { verbose: true, dry: false })
  37. ]
  38. })