webpack.config.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. var config = {
  4. mode: "development",
  5. externals: {
  6. 'react': 'React',
  7. 'react-dom': 'ReactDOM',
  8. },
  9. module: {
  10. rules: [
  11. {
  12. // docs: https://webpack.js.org/configuration/module/#resolvefullyspecified
  13. test: /\.m?js/,
  14. resolve: {
  15. fullySpecified: false,
  16. }
  17. }
  18. ]
  19. },
  20. plugins: [
  21. // fix "process is not defined" error:
  22. new webpack.ProvidePlugin({
  23. process: 'process/browser',
  24. }),
  25. ],
  26. };
  27. var AppConfig = Object.assign({}, config, {
  28. name: "app",
  29. entry: {
  30. "db-worker" : "./target/db-worker.js",
  31. "inference-worker" : "./target/inference-worker.js"
  32. },
  33. output: {
  34. path: path.resolve(__dirname, 'static/js'),
  35. filename: '[name]-bundle.js',
  36. clean: false,
  37. chunkLoading: false,
  38. },
  39. });
  40. var MobileConfig = Object.assign({}, config, {
  41. name: "mobile",
  42. entry: {
  43. "db-worker" : "./target/db-worker.js",
  44. },
  45. output: {
  46. path: path.resolve(__dirname, 'static/mobile/js'),
  47. filename: '[name]-bundle.js',
  48. clean: false,
  49. chunkLoading: false,
  50. },
  51. });
  52. module.exports = [
  53. AppConfig, MobileConfig,
  54. ];