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

Module Federation Plugin for Vite #2768

Open
2 tasks done
douglaszaltron opened this issue Jul 20, 2024 · 6 comments
Open
2 tasks done

Module Federation Plugin for Vite #2768

douglaszaltron opened this issue Jul 20, 2024 · 6 comments

Comments

@douglaszaltron
Copy link

douglaszaltron commented Jul 20, 2024

Clear and concise description of the problem

With the advent of @module-federation/esbuild, can we expect an official plugin to work with Vite? I say this because Vite has a large adoption. This would be wonderful for the module federation ecosystem.

Suggested solution

Today, for Vite, we have some options, but none integrated with the core of module federation, as the @module-federation/vite plugin still depends on @softarc/native-federation-esbuild.

Alternative

No response

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@zackarychapple
Copy link
Collaborator

zackarychapple commented Jul 20, 2024

Happily this is something we can expect to see as "officially" supported. @yyx990803 has put this on the roadmap for Rolldown which is going to be the basis for the next version of Vite.

@zhangHongEn
Copy link

I am implementing this plugin, and I would like to ask here, how should I handle the first parameter of init and the shared of init, whether @module-federation/runtime should provide a merge api, or who can tell me how to do it, I am only one step away from completion

https://github.com/zhangHongEn/module-federation-vite/blob/9c3713ec24cb459f5f998ccb820c176cef65ae5c/packages/module-federation-vite/src/index.js#L48

@zackarychapple
Copy link
Collaborator

zackarychapple commented Jul 23, 2024

fantastic news @zhangHongEn! Will work on getting you answers asap.

@ScriptedAlchemy @zmzlois can we dig into this.

@MadaraUchiha-314
Copy link
Contributor

MadaraUchiha-314 commented Jul 23, 2024

Can we just make this work with vite ? https://github.com/MadaraUchiha-314/rollup-plugin-module-federation

It already uses the runtime and the sdk and has solved most of the problems related to supporting MF 2.0

Happy to collaborate on this. @zhangHongEn

FYI, I have been collaborating with @ScriptedAlchemy on this for the past few months and it's almost close to completion

@MadaraUchiha-314
Copy link
Contributor

how should I handle the first parameter of init and the shared of init

https://github.com/MadaraUchiha-314/rollup-plugin-module-federation/blob/main/packages/rollup-plugin-module-federation/src/index.ts#L585

This is how you use the shareScope that's passed into init ^

@zhangHongEn
Copy link

how should I handle the first parameter of init and the shared of init

https://github.com/MadaraUchiha-314/rollup-plugin-module-federation/blob/main/packages/rollup-plugin-module-federation/src/index.ts#L585

This is how you use the shareScope that's passed into init ^

Thanks, this is very useful

I already support dev and build modes of vite, and have all the main features, but I haven't done other enhancements of 2.0, such as manifest.json and runtime plugins, etc. Can I PR here and then we can improve it together?
module-federation/vite#4

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

4 participants