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

相关内容

热门资讯

透视解密!wpk俱乐部怎么作必... 透视解密!wpk俱乐部怎么作必弊,wpk插件(透视)其实真的是有方法(哔哩哔哩)运辅助工具,进入游戏...
无独有偶!hh poker辅助... 无独有偶!hh poker辅助器先试用,微信微乐自建房脚本免费下载,推荐透视(有挂头条)-哔哩哔哩1...
脚本推荐!aapoker免费透... 脚本推荐!aapoker免费透视脚本,aapoker真的假的(透视)都是是真的脚本(哔哩哔哩)1、下...
反观!wepokerplus万... 反观!wepokerplus万能挂,微乐小程序自建房透视,辅助透视(有挂教程)-哔哩哔哩1、实时we...
脚本总结!hhpoker辅助挂... 脚本总结!hhpoker辅助挂下载,hhpoker有没有辅助(透视)确实真的是有软件(哔哩哔哩)1、...
今年以来!wepoker黑侠辅... 今年以来!wepoker黑侠辅助器正版下载,微乐辅助脚本,解迷透视(有挂教学)-哔哩哔哩1、wepo...
围绕透视问题!aa poker... 围绕透视问题!aa poker透视软件,微乐智能辅助真的假的,专业脚本(有挂总结)-哔哩哔哩1、每一...
透视科普!aapoker插件下... 透视科普!aapoker插件下载,aapoker透视脚本(透视)原来是有挂(哔哩哔哩)1、这是跨平台...
透视软件!hhpoker必备开... 透视软件!hhpoker必备开挂,微信小程序微乐破解器2025,科普脚本(有挂技巧)-哔哩哔哩1)h...
脚本解密!德普之星辅助工具如何... 脚本解密!德普之星辅助工具如何打开,德普之星私人局辅助器(透视)其实是有技巧(哔哩哔哩)1、完成有辅...