webpack.config.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. },
  32. output: {
  33. path: path.resolve(__dirname, 'static/js'),
  34. filename: '[name]-bundle.js',
  35. clean: false,
  36. chunkLoading: false,
  37. },
  38. });
  39. var MobileConfig = Object.assign({}, config, {
  40. name: "mobile",
  41. entry: {
  42. "db-worker" : "./target/db-worker.js",
  43. },
  44. output: {
  45. path: path.resolve(__dirname, 'static/mobile/js'),
  46. filename: '[name]-bundle.js',
  47. clean: false,
  48. chunkLoading: false,
  49. },
  50. });
  51. module.exports = [
  52. AppConfig, MobileConfig,
  53. ];