custom-webpack.config.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //const webpack = require('webpack');
  2. const { shareAll, withModuleFederationPlugin } = require('@angular-architects/module-federation/webpack');
  3. const {
  4. ModifyEntryPlugin,
  5. } = require('@angular-architects/module-federation/src/utils/modify-entry-plugin');
  6. const baseConfig = require('./base-webpack.config');
  7. const webpackConfig = {
  8. ...withModuleFederationPlugin({
  9. name: 'fieldcalc',
  10. exposes: {
  11. './FcCalculatorComponent': './src/app/calculator/calculator-panel.component.ts',
  12. },
  13. shared: {
  14. "@angular/core": {
  15. singleton: true,
  16. strictVersion: false,
  17. requiredVersion: "auto",
  18. },
  19. "@angular/common": {
  20. singleton: true,
  21. strictVersion: false,
  22. requiredVersion: "auto",
  23. },
  24. "@angular/forms": {
  25. singleton: true,
  26. strictVersion: false,
  27. requiredVersion: "auto",
  28. },
  29. "@angular/common/http": {
  30. singleton: true,
  31. strictVersion: false,
  32. requiredVersion: "auto",
  33. },
  34. "@angular/router": {
  35. singleton: true,
  36. strictVersion: false,
  37. requiredVersion: "auto",
  38. },
  39. "@ngx-translate/core": { singleton: true, strictVersion: false },
  40. "@angular/localize/init": {
  41. singleton: true,
  42. eager: true
  43. },
  44. 'ol': {singleton: true, requiredVersion: '^7.1.0'},
  45. 'ol-ext': {singleton: true, requiredVersion: '^4.0.3'},
  46. 'ol/layer': {
  47. singleton: true,
  48. },
  49. 'ol/source': {
  50. singleton: true,
  51. },
  52. 'hslayers-ng': {
  53. singleton: true,
  54. },
  55. },
  56. })
  57. }
  58. const plugins = webpackConfig.plugins.filter((plugin) => !(plugin instanceof ModifyEntryPlugin));
  59. // // Uncomment for debugging.
  60. // console.log('webpackConfig:::', webpackConfig);
  61. // console.log('plugins:::', plugins);
  62. webpackConfig.resolve.fallback = baseConfig.resolve.fallback;
  63. module.exports = {
  64. ...webpackConfig,
  65. plugins,
  66. };
  67. /*module.exports = {
  68. devtool: false,
  69. plugins: [
  70. new webpack.SourceMapDevToolPlugin({
  71. filename: '[file].map',
  72. exclude: ['vendor.js'],
  73. })
  74. ],
  75. };*/