You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
1.9 KiB

  1. const path = require('path');
  2. const TerserPlugin = require('terser-webpack-plugin');
  3. const { SourceMapDevToolPlugin } = require('webpack');
  4. const VueLoaderPlugin = require('vue-loader/lib/plugin');
  5. module.exports = {
  6. mode: 'production',
  7. entry: {
  8. index: ['./web_src/js/index'],
  9. swagger: ['./web_src/js/swagger'],
  10. jquery: ['./web_src/js/jquery'],
  11. },
  12. devtool: false,
  13. output: {
  14. path: path.resolve(__dirname, 'public/js'),
  15. filename: '[name].js',
  16. chunkFilename: '[name].js',
  17. },
  18. optimization: {
  19. minimize: true,
  20. minimizer: [new TerserPlugin({
  21. sourceMap: true,
  22. extractComments: false,
  23. terserOptions: {
  24. output: {
  25. comments: false,
  26. },
  27. },
  28. })],
  29. },
  30. module: {
  31. rules: [
  32. {
  33. test: /\.vue$/,
  34. exclude: /node_modules/,
  35. loader: 'vue-loader'
  36. },
  37. {
  38. test: /\.js$/,
  39. exclude: /node_modules/,
  40. use: {
  41. loader: 'babel-loader',
  42. options: {
  43. presets: [
  44. [
  45. '@babel/preset-env',
  46. {
  47. useBuiltIns: 'usage',
  48. corejs: 3,
  49. }
  50. ]
  51. ],
  52. plugins: [
  53. [
  54. '@babel/plugin-transform-runtime',
  55. {
  56. regenerator: true,
  57. }
  58. ],
  59. '@babel/plugin-proposal-object-rest-spread',
  60. ],
  61. }
  62. }
  63. },
  64. {
  65. test: /\.css$/i,
  66. use: ['style-loader', 'css-loader'],
  67. },
  68. ]
  69. },
  70. plugins: [
  71. new VueLoaderPlugin(),
  72. new SourceMapDevToolPlugin({
  73. filename: '[name].js.map',
  74. exclude: [
  75. 'swagger.js',
  76. ],
  77. }),
  78. ],
  79. performance: {
  80. maxEntrypointSize: 512000,
  81. maxAssetSize: 512000,
  82. assetFilter: (filename) => {
  83. return !filename.endsWith('.map') && filename !== 'swagger.js';
  84. }
  85. },
  86. };