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.

webpack.config.js 836B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. const path = require('path');
  2. const TerserPlugin = require('terser-webpack-plugin');
  3. module.exports = {
  4. mode: 'production',
  5. entry: {
  6. index: ['./web_src/js/index', './web_src/js/draw']
  7. },
  8. devtool: 'source-map',
  9. output: {
  10. path: path.resolve(__dirname, 'public/js'),
  11. filename: 'index.js'
  12. },
  13. optimization: {
  14. minimize: true,
  15. minimizer: [new TerserPlugin({
  16. sourceMap: true,
  17. })],
  18. },
  19. module: {
  20. rules: [
  21. {
  22. test: /\.js$/,
  23. exclude: /node_modules/,
  24. use: {
  25. loader: 'babel-loader',
  26. options: {
  27. presets: [
  28. [
  29. '@babel/preset-env',
  30. {
  31. useBuiltIns: 'entry',
  32. corejs: 3,
  33. }
  34. ]
  35. ]
  36. }
  37. }
  38. }
  39. ]
  40. }
  41. };