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

相关内容

热门资讯

2分钟法门!德州透视hhpok... 2分钟法门!德州透视hhpoker(透视)真是真的有辅助神器(哔哩哔哩)1、超多福利:超高返利,海量...
3分钟绝活!wepokerpl... 3分钟绝活!wepokerplus外开挂(透视)好像有辅助开挂(哔哩哔哩)该软件可以轻松地帮助玩家将...
4分钟资料!wepoker免费... 您好,wepoker免费脚本弱密码这款游戏可以开挂的,确实是有挂的,需要了解加去威信【4852750...
第7分钟积累!hhpoker哪... 第7分钟积累!hhpoker哪个俱乐部靠谱(透视)确实真的有辅助透视(哔哩哔哩)1、hhpoker哪...
第6分钟举措!wepoker私... 第6分钟举措!wepoker私人局怎么玩(透视)一贯存在有辅助插件(哔哩哔哩)一、wepoker私人...
第2分钟操作!wepoker免... 第2分钟操作!wepoker免费透视脚本(透视)原来存在有辅助下载(哔哩哔哩)1、起透看视 wepo...
第9分钟法门!we-poker... 第9分钟法门!we-poker辅助器(透视)切实真的有辅助神器(哔哩哔哩)1、让任何用户在无需we-...
四分钟积累!wepoker辅助... 四分钟积累!wepoker辅助器激活码(透视)一直是真的有辅助脚本(哔哩哔哩)1、实时wepoker...
第6分钟手册!智星德州辅助译码... 第6分钟手册!智星德州辅助译码插件靠谱吗(透视)总是是真的有辅助透视(哔哩哔哩)1、进入到智星德州辅...
第一分钟绝活儿!hhpoker... 第一分钟绝活儿!hhpoker软件靠谱吗(透视)切实真的有辅助工具(哔哩哔哩)1、首先打开hhpok...