webpack.config.prod.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. const path = require('path')
  2. const merge = require('webpack-merge')
  3. const CopyPlugin = require('copy-webpack-plugin')
  4. const base = require('./webpack.config')
  5. const PackageVersions = require('./app/src/infrastructure/PackageVersions')
  6. module.exports = merge(base, {
  7. mode: 'production',
  8. // Enable a full source map. Generates a comment linking to the source map
  9. devtool: 'source-map',
  10. output: {
  11. // Override output path to minjs dir
  12. path: path.join(__dirname, '/public/minjs'),
  13. // Override filename to include hash for immutable caching
  14. filename: '[name]-[chunkhash].js',
  15. publicPath: '/minjs/'
  16. },
  17. plugins: [
  18. // Copy vendored dependencies to minjs directory as these are directly
  19. // loaded in a script tag by instead of being part of the webpack build
  20. new CopyPlugin([
  21. {
  22. from: 'public/js/libs/angular-1.6.4.min.js',
  23. to: 'libs/angular-1.6.4.min.js'
  24. },
  25. {
  26. from: 'public/js/libs/angular-1.6.4.min.js.map',
  27. to: 'libs/angular-1.6.4.min.js.map'
  28. },
  29. {
  30. from: 'public/js/libs/jquery-1.11.1.min.js',
  31. to: 'libs/jquery-1.11.1.min.js'
  32. },
  33. {
  34. from: 'public/js/libs/jquery-1.11.1.min.js.map',
  35. to: 'libs/jquery-1.11.1.min.js.map'
  36. },
  37. {
  38. from: 'public/js/libs/mathjax',
  39. to: 'libs/mathjax'
  40. },
  41. {
  42. from: 'public/js/libs/sigma-master',
  43. to: 'libs/sigma-master'
  44. },
  45. {
  46. from: `public/js/ace-${PackageVersions.version.ace}/`,
  47. to: `ace-${PackageVersions.version.ace}/`
  48. }
  49. ])
  50. ]
  51. })