Bladeren bron

build: Make eager chunk hack

raitis 2 jaren geleden
bovenliggende
commit
bf78a4b249
2 gewijzigde bestanden met toevoegingen van 32 en 9 verwijderingen
  1. 8 0
      base-webpack.config.js
  2. 24 9
      custom-webpack.config.js

+ 8 - 0
base-webpack.config.js

@@ -0,0 +1,8 @@
+module.exports = {
+  resolve: {
+    fallback: {
+      "path": false,
+      "fs": false,
+    },
+  },
+};

+ 24 - 9
custom-webpack.config.js

@@ -1,7 +1,12 @@
 //const webpack = require('webpack');
 const { shareAll, withModuleFederationPlugin } = require('@angular-architects/module-federation/webpack');
+const {
+  ModifyEntryPlugin,
+} = require('@angular-architects/module-federation/src/utils/modify-entry-plugin');
+const baseConfig = require('./base-webpack.config');
 
-const withModuleFederationConfig = withModuleFederationPlugin({
+const webpackConfig = {
+  ...withModuleFederationPlugin({
   name: 'fieldcalc',
   exposes: {
     './FcCalculatorComponent': './src/app/calculator/calculator-panel.component.ts',
@@ -35,6 +40,7 @@ const withModuleFederationConfig = withModuleFederationPlugin({
     "@ngx-translate/core": { singleton: true, strictVersion: false },
     "@angular/localize/init": {
       singleton: true,
+      eager: true
     },
     'ol': {singleton: true, requiredVersion: '^7.1.0'},
     'ol-ext': {singleton: true, requiredVersion: '^4.0.3'},
@@ -46,17 +52,26 @@ const withModuleFederationConfig = withModuleFederationPlugin({
     },
     'hslayers-ng': {
       singleton: true,
-      strictVersion: true,
-      requiredVersion: '^11.0.0',
-      version: '11.0.0'
     },
   },
-});
-withModuleFederationConfig.resolve.fallback = {
-  "path": false,
-  "fs": false
+})
+}
+
+const plugins = webpackConfig.plugins.filter((plugin) => !(plugin instanceof ModifyEntryPlugin));
+
+// // Uncomment for debugging.
+// console.log('webpackConfig:::', webpackConfig);
+// console.log('plugins:::', plugins);
+
+webpackConfig.resolve.fallback = baseConfig.resolve.fallback;
+
+module.exports = {
+  ...webpackConfig,
+  plugins,
 };
-module.exports = withModuleFederationConfig;
+
+
+
 
 /*module.exports = {
   devtool: false,