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 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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']
  7. },
  8. devtool: 'source-map',
  9. output: {
  10. path: path.resolve(__dirname, 'public/js'),
  11. filename: 'index.js',
  12. chunkFilename: '[name].js',
  13. },
  14. optimization: {
  15. minimize: true,
  16. minimizer: [new TerserPlugin({
  17. sourceMap: true,
  18. extractComments: false,
  19. terserOptions: {
  20. output: {
  21. comments: false,
  22. },
  23. },
  24. })],
  25. },
  26. module: {
  27. rules: [
  28. {
  29. test: /\.js$/,
  30. exclude: /node_modules/,
  31. use: {
  32. loader: 'babel-loader',
  33. options: {
  34. presets: [
  35. [
  36. '@babel/preset-env',
  37. {
  38. useBuiltIns: 'usage',
  39. corejs: 3,
  40. }
  41. ]
  42. ],
  43. plugins: [
  44. [
  45. '@babel/plugin-transform-runtime',
  46. {
  47. regenerator: true,
  48. }
  49. ]
  50. ],
  51. }
  52. }
  53. },
  54. {
  55. test: /\.css$/i,
  56. use: ['style-loader', 'css-loader'],
  57. },
  58. ]
  59. }
  60. };