ice icon indicating copy to clipboard operation
ice copied to clipboard

build.json中自定义 moduleFederation 时,无法同时配置 remotes 和 exposes

Open smat0096 opened this issue 3 years ago • 2 comments

What is the current behavior? 发生了什么?

build.json中自定义 moduleFederation 时,无法同时配置为 host 和 remote,webpack编译出来的文件报语法错误;

moduleFederation : { name: 'MF_subAppMF', shared: { react: { singleton: true }, 'react-dom': { singleton: true }, 'react-router': { singleton: true }, 'react-router-dom': { singleton: true }, '@alifd/next': { singleton: true }, echarts: { singleton: true } }, exposes: { './MicroPage': './src/pages/Examples/MicroPage' }, remotes: { MF_subAppMF: 'MF_subAppMF@//localhost:9999/remoteEntry.js' }, library: { type: 'var', name: 'MF_subAppMF' }, filename: 'remoteEntry.js' } 打包出来的异常代码: QQ图片20220320013255

移除filename,library,exposes等remote相关配置,正常打包出来的代码为: QQ图片20220320013038

What is the expected behavior? 期望的结果是什么?

能将一个应用同时构建为host和remote

Any additional comments? 相关环境信息?

  • ice.js Version: 2.6.0
  • build.json Configuration
  • Node Version:
  • Platform:

smat0096 avatar Mar 19 '22 17:03 smat0096

先确认下配置步骤 https://github.com/alibaba/ice/issues/4900

ClarkXia avatar Mar 21 '22 02:03 ClarkXia

企业微信截图_16488090847939 配置如图, 同时配置 exposes和 remotes时会复现以上bug, 其他情况无问题, @ClarkXia

smat0096 avatar Apr 01 '22 10:04 smat0096