Skip to content
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

[Bug] umi3升级到umi4,chainWebpack配置模块联邦产出的文件格式不同 紧急 #12720

Open
liyang1234567890 opened this issue Sep 25, 2024 · 1 comment

Comments

@liyang1234567890
Copy link

liyang1234567890 commented Sep 25, 2024

这是我的chainWebpack配置
  chainWebpack(memo, { env, webpack, createCSSRule }) {
    memo.plugin('module-federation').use(
      new webpack.container.ModuleFederationPlugin({
        name: 'abtest',
        filename: 'remoteEntry.js',
        exposes: {
          './dataset_list': './src/pages/dataset/exposes/list.tsx',
          './dataset_config': './src/pages/dataset/exposes/config.tsx',
        },
        library: { type: 'var', name: 'abtest' },
      }),
    );
  }

在umi3项目中生成的remoteEntry.js文件
umi3

umi4项目中生成的remoteEntry.js文件
umi4

导致现在在远程应用中获取不到window.abtest,报错_virtual___federation__.a5d80c56.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'init'),无法正常展示页面
报错

求回复,感谢

@stormslowly
Copy link
Member

觉得你可能需要修改这个配置 https://webpack.js.org/configuration/output/#outputlibrarytype

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants