-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
引用组件的项目,启动后提示不能再入口文件中使用 #16
Comments
https://webpack.js.org/concepts/module-federation/#troubleshooting 如果你不清楚如何修改 可以贴一下entry代码我来修改 |
可以给个示例吗?我的代码太长,是业务逻辑,总得来说,我的业务需求是必须在entry设置的js文件里引入远程模块的js处理业务 |
entry:{ |
简单的说就是把a.js的内容复制到bootstrap.js中去 entry:{
app: 'a.js'
} // a.js
import("./bootstrap.js") // bootstrap.js
impot service from service/main'; // 引用远程模块 |
为什么这样就可以避开限制,执行结果不也相当于引入远程模块吗? |
entry a.js作为入口 会被任意其他项目用各种方式(如script、fetch、systemjs等)引入, 它的加载方式不受webpack干涉, 所以无法等待远程模块的加载。 |
我讲a.js的内容全部移动到bootstrap.js,然后执行,又提示变量不存在,是不是应该有什么特殊设置? |
微信zhang_h_n |
创建 bootstrap.js 可以解决你的问题 (https://webpack.js.org/concepts/module-federation/#troubleshooting) |
排查了一下是webpack的entry文件中有引用,为什么会有这样的限制,怎么避开?
The text was updated successfully, but these errors were encountered: