webpack.config.js 767 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. module.exports = {
  4. mode: "development",
  5. entry: {
  6. main : "./target/main.js",
  7. workers : "./target/workers.js"
  8. },
  9. externals: {
  10. 'react': 'React',
  11. 'react-dom': 'ReactDOM',
  12. },
  13. output: {
  14. path: path.resolve(__dirname, 'static/js'),
  15. filename: '[name]-bundle.js',
  16. clean: false,
  17. chunkLoading: false,
  18. },
  19. module: {
  20. rules: [
  21. {
  22. // docs: https://webpack.js.org/configuration/module/#resolvefullyspecified
  23. test: /\.m?js/,
  24. resolve: {
  25. fullySpecified: false,
  26. }
  27. }
  28. ]
  29. },
  30. plugins: [
  31. // fix "process is not defined" error:
  32. new webpack.ProvidePlugin({
  33. process: 'process/browser',
  34. }),
  35. ],
  36. };