webpack.prod.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. const { 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-plugin2')
  6. const { CleanWebpackPlugin } = require('clean-webpack-plugin')
  7. module.exports = merge(common, {
  8. output: {
  9. filename: '[name].min.js',
  10. path: path.resolve(__dirname, 'build'),
  11. library: 'opensheetmusicdisplay',
  12. libraryTarget: 'umd'
  13. },
  14. mode: 'production',
  15. optimization: {
  16. minimize: true
  17. // splitChunks: {
  18. // chunks: 'all',
  19. // name: false
  20. // }
  21. },
  22. plugins: [
  23. // build optimization plugins
  24. new CleanWebpackPlugin({
  25. verbose: false,
  26. dry: false,
  27. cleanOnceBeforeBuildPatterns: ['**/*', '!statistics.html*']
  28. }),
  29. new webpack.LoaderOptionsPlugin({
  30. minimize: true,
  31. debug: true
  32. }),
  33. new Visualizer({
  34. path: path.resolve(__dirname, 'build'),
  35. filename: './statistics.html'
  36. })
  37. ]
  38. })