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.

94 lines
2.1 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. {
  42. loader: 'babel-loader',
  43. options: {
  44. presets: [
  45. [
  46. '@babel/preset-env',
  47. {
  48. useBuiltIns: 'usage',
  49. corejs: 3,
  50. }
  51. ]
  52. ],
  53. plugins: [
  54. [
  55. '@babel/plugin-transform-runtime',
  56. {
  57. regenerator: true,
  58. }
  59. ],
  60. '@babel/plugin-proposal-object-rest-spread',
  61. ],
  62. }
  63. },
  64. ],
  65. },
  66. {
  67. test: /\.css$/i,
  68. use: ['style-loader', 'css-loader'],
  69. },
  70. ]
  71. },
  72. plugins: [
  73. new VueLoaderPlugin(),
  74. new SourceMapDevToolPlugin({
  75. filename: '[name].js.map',
  76. exclude: [
  77. 'gitgraph.js',
  78. 'jquery.js',
  79. 'swagger.js',
  80. ],
  81. }),
  82. ],
  83. performance: {
  84. maxEntrypointSize: 512000,
  85. maxAssetSize: 512000,
  86. assetFilter: (filename) => {
  87. return !filename.endsWith('.map') && filename !== 'swagger.js';
  88. }
  89. },
  90. resolve: {
  91. symlinks: false,
  92. }
  93. };