TypeError: Cannot read property 'includes' of undefined at ModuleFederationPlugin.apply

TypeError: Cannot read property 'includes' of undefined at ModuleFederationPlugin.apply

我正在尝试在我的 angular 项目中使用 Module Federation Plugin,但出现此错误 -

[error] TypeError: Cannot read property 'includes' of undefined
    at ModuleFederationPlugin.apply (C:\Users\HP\test-app\node_modules\webpack\lib\container\ModuleFederationPlugin.js:45:49)
    at Object.webpack [as webpackFactory] (C:\Users\HP\test-app\node_modules\@angular-devkit\build-angular\node_modules\webpack\lib\webpack.js:51:13)
    at createWebpack (C:\Users\HP\test-app\node_modules\@angular-devkit\build-webpack\src\webpack-dev-server\index.js:21:36)
    at Object.runWebpackDevServer (C:\Users\HP\test-app\node_modules\@angular-devkit\build-webpack\src\webpack-dev-server\index.js:47:12)
    at SwitchMapSubscriber.project (C:\Users\HP\test-app\node_modules\@angular-devkit\build-angular\src\dev-server\index.js:221:32)
    at SwitchMapSubscriber._next (C:\Users\HP\test-app\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\operators\switchMap.js:47:27)
    at SwitchMapSubscriber.Subscriber.next (C:\Users\HP\test-app\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\Subscriber.js:66:18)
    at C:\Users\HP\test-app\node_modules\@angular-devkit\build-angular\node_modules\rxjs\internal\util\subscribeToPromise.js:7:24
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

我的项目需要两个 webpacks - 用于模块联合插件的 webpack 5 和用于 angular-devkit/build-angular@0.1102.3.

的 webpack@4.44.2

如何解决这个问题?如果您在 Angular.

中使用过 Module Federation 插件,请告诉我

我用这个 https://github.com/webpack/webpack/issues/12165#issuecomment-802947759

解决了这个问题

此外,我发现这已在 Angular 12 中解决。使用 angular 12.

不会遇到此错误