Kaynağa Gözat

build: Make eager chunk hack

raitis 2 yıl önce
ebeveyn
işleme
75b7868256
1 değiştirilmiş dosya ile 24 ekleme ve 7 silme
  1. 24 7
      custom-webpack.config.js

+ 24 - 7
custom-webpack.config.js

@@ -1,7 +1,11 @@
 //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 withModuleFederationConfig = withModuleFederationPlugin({
+const webpackConfig = {
+  ...withModuleFederationPlugin({
   name: 'fieldcalc',
   exposes: {
     './FcCalculatorComponent': './src/app/calculator/calculator-panel.component.ts',
@@ -35,6 +39,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 +51,29 @@ const withModuleFederationConfig = withModuleFederationPlugin({
     },
     'hslayers-ng': {
       singleton: true,
-      strictVersion: true,
-      requiredVersion: '^11.0.0',
-      version: '11.0.0'
     },
   },
-});
-withModuleFederationConfig.resolve.fallback = {
+})
+}
+
+const plugins = webpackConfig.plugins.filter((plugin) => !(plugin instanceof ModifyEntryPlugin));
+
+// // Uncomment for debugging.
+// console.log('webpackConfig:::', webpackConfig);
+// console.log('plugins:::', plugins);
+
+webpackConfig.resolve.fallback = {
   "path": false,
   "fs": false
 };
-module.exports = withModuleFederationConfig;
+
+module.exports = {
+  ...webpackConfig,
+  plugins,
+};
+
+
+
 
 /*module.exports = {
   devtool: false,