【问题标题】:Angular Material and Kendo doesn't work with Module Federation Plugin: Bootstrap call not foundAngular Material 和 Kendo 不适用于 Module Federation 插件:未找到引导调用
【发布时间】:2022-10-31 15:07:23
【问题描述】:
我使用 Angular CLI 和 Module Federation Plugin 构建了一个微前端应用程序。
当我尝试安装 Angular Material 或 Kendo 时,我遇到了这个问题:
Bootstrap call not found
我按照link 解决了这个问题。不幸的是,我还有更多问题:
- 安装 Angular Material 时,出现以下错误:
Your project is not using the default builders for "build". The Angular Material schematics cannot add a theme to the workspace configuration if the builder has been changed.
- 安装 Kendo 时,出现以下错误:
Skipping installation: Package already installed. File node_modules/@progress/kendo-angular-buttons/package.json does not exist.
【问题讨论】:
标签:
angular
angular-material
kendo-ui-angular2
micro-frontend
webpack-module-federation
【解决方案1】:
我找到了解决方案。在安装库之前,我将 main.ts 的内容替换为 bootstrap.ts 的内容:
main.ts:
/*import('./bootstrap')
.catch(err => console.error(err));
*/
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
安装库后,我恢复了它的内容:
import('./bootstrap')
.catch(err => console.error(err));
这不是最好的解决方案,但它有效!
【解决方案2】:
检查您的 angular.json 文件。对我来说,错误“已安装包”是由于 angular.json 中已经存在相同的命名库。从那里移除,我能够工作而不会出现任何错误。