-
Notifications
You must be signed in to change notification settings - Fork 291
Remote
Joe Zhang edited this page Sep 1, 2021
·
2 revisions
- Remote端需要实现2个特性:
- 提供RemoteEntry.js入口文件给Host端
- 将配置的模块单独打包chunk
- 相关的配置为exposes选项,例如
exposes: {
'./Content': './src/components/Content.vue',
'./Button': './src/components/Button.js',
},RemoteEntry.js需要暴露出 init(), get()两个函数供Host使用
let moduleMap = {
"./Button":()=>{return import('./button.js')},};
const get =(module, getScope) => {
return moduleMap[module]();
};
const init =(shareScope, initScope) => {
let global = window || node;
global.__rf_var__shared= shareScope;
};
export { get, init };