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

[Feature]: Modern.js Module build support module federation #6401

Closed
tky753 opened this issue Oct 18, 2024 · 6 comments
Closed

[Feature]: Modern.js Module build support module federation #6401

tky753 opened this issue Oct 18, 2024 · 6 comments

Comments

@tky753
Copy link

tky753 commented Oct 18, 2024

这个功能解决了什么问题?

开发插件架构项目。

  1. 主项目相当于一个基座,用Modern.js framework开发打包;
  2. 功能模块放在nginx里用模块联邦动态加载。

你期望的 API 是什么样子的?

Modern.js Module 打包支持 模块联邦

@nyqykk
Copy link
Member

nyqykk commented Oct 18, 2024

是说希望 provider 是 module 类型吗

@tky753
Copy link
Author

tky753 commented Oct 18, 2024

modern.config.ts 类似于这样:

import { defineConfig, moduleTools } from '@modern-js/module-tools'
import { moduleFederationPlugin } from '@module-federation/modern-js'

export default defineConfig({
  plugins: [moduleTools(), moduleFederationPlugin()],
  buildConfig: {
    ...
  }
})

现在这样写,模块联邦的部分打包不出来

@nyqykk
Copy link
Member

nyqykk commented Oct 18, 2024

modern.config.ts 类似于这样:

import { defineConfig, moduleTools } from '@modern-js/module-tools'
import { moduleFederationPlugin } from '@module-federation/modern-js'

export default defineConfig({
plugins: [moduleTools(), moduleFederationPlugin()],
buildConfig: {
...
}
})
现在这样写,模块联邦的部分打包不出来

web-infra-dev/rslib#240 这个应该可以解决你的需求,最近几天就会发布

@tky753
Copy link
Author

tky753 commented Oct 18, 2024

这个rslib感觉和modern.js module是不是定位重叠了?

@tky753 tky753 closed this as completed Oct 18, 2024
@nyqykk
Copy link
Member

nyqykk commented Oct 18, 2024

这个rslib感觉和modern.js module是不是定位重叠了?

不一样,modern module 是 esbuild 构建,rslib 是 rspack 构建,后续会比较推荐 rslib

@tky753
Copy link
Author

tky753 commented Oct 18, 2024

好的,谢谢解答😊

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

No branches or pull requests

2 participants