AngularMaterial和Kendo不适用于ModuleFederationPlugin:找不到Bootstrap调用。
创始人
2024-10-28 09:30:24
0

以下是一种解决方法。请注意,由于Angular Material和Kendo组件中存在任意数量的Bootstrap调用,因此此解决方法可能需要进行相应的调整。

1.在web components项目中安装webpack。可以使用以下命令:

npm install webpack --save-dev

2.将以下代码添加到“webpack.config.js”中:

const webpack = require('webpack'); const ModuleFederationPlugin = webpack.container.ModuleFederationPlugin; const nodeExternals = require('webpack-node-externals');

module.exports = { entry: './src/index.js', output: { filename: 'index.js', path: './dist', libraryTarget: 'commonjs2' }, target: 'node', externals: [nodeExternals()], plugins: [ new ModuleFederationPlugin({ name: 'your_project_name', library: { type: 'commonjs2' }, filename: 'remoteEntry.js', exposes: { './Module': './src/Module.js' }, shared: { '@angular/core': { requiredVersion: '11.3.0' }, '@angular/common': { requiredVersion: '11.3.0' }, '@angular/router': { requiredVersion: '11.3.0' }, ... } }), ] };

3.在Angular Material和Kendo依赖项中添加Bootstrap调用。例如,在“@angular/material”中,需要将以下代码添加到具有模块引用的文件:

import 'bootstrap/dist/css/bootstrap.min.css';

4.生成远程加载项并将其部署到远程服务器。

5.在主应用程序中,使用以下代码将远程加载项加载到Angular应用程序中:

import { loadRemoteEntry } from '@angular-architects/module-federation';

const url = 'http://your_remote_url/remoteEntry.js';

loadRemoteEntry(url, 'your_project_name') .then(() => import('remote_entry/Module')) .then(m => platformBrowserDynamic().bootstrapModule(m.Module

相关内容

热门资讯

随着!拱趴大菠萝万能挂图解,智... 随着!拱趴大菠萝万能挂图解,智星菠萝可以辅助吗,真是是有挂(证实有挂)1、下载好智星菠萝可以辅助吗透...
分辨真假!wepoker辅助器... 分辨真假!wepoker辅助器,wepoker公共底牌,好像真的是有挂(有挂分析)1、许多玩家不知道...
突发!约局吧透视挂下载,德普之... 突发!约局吧透视挂下载,德普之星私人局辅助免费,一直确实有挂(有挂猫腻)进入游戏-大厅左侧-新手福利...
玩家必备科普!hhpoker买... 玩家必备科普!hhpoker买挂,wepoker私人局可以透视,确实有挂(有挂功能)1、游戏颠覆性的...
揭秘攻略!wepoker代打辅... 揭秘攻略!wepoker代打辅助,德州hhpoker是真的吗,真是真的是有挂(存在有挂)破解侠是真的...
2026版教学!wepoker... 2026版教学!wepoker私人局俱乐部怎么进,德普之星私人局辅助免费,总是真的是有挂(有挂分享)...
一分钟教会你!wpk辅助器是真... 一分钟教会你!wpk辅助器是真的吗,hhpoker有没有外挂,其实真的是有挂(有挂技巧)1、公共底牌...
黑科技攻略!hh poker辅... 黑科技攻略!hh poker辅助器先试用,德扑之星辅助工具如何设置,一直确实有挂(有挂解密)1、德扑...
记者揭秘!aapoker怎么选... 记者揭秘!aapoker怎么选牌,wpk辅助购买,好像是真的有挂(有挂技巧)1、下载好脚本下载之后点...
2026版辅助挂!大菠萝免费辅... 2026版辅助挂!大菠萝免费辅助,智星菠萝透视,原来存在有挂(有挂方式)所有人都在同一条线上,像星星...