vite icon indicating copy to clipboard operation
vite copied to clipboard

feat: support Type Declerations

Open econneely opened this issue 1 year ago • 14 comments

Does this support the hotreloading of types mentioned here and if so is there any examples of how to implement it https://module-federation.io/guide/basic/type-prompt.html

Does this have something to do with it not working https://github.com/module-federation/vite/blob/main/src/plugins/pluginMFManifest.ts#L376-L377

react refresh:6 [ dynamic-remote-type-hints-plugin ] err: [object Event] this is also one of the errors on the host side and the remote is using webpack and its manifest has a reference to the .d.ts and zip

econneely avatar Sep 26 '24 14:09 econneely

Hi @econneely, can you open a PR with a failing scenario in this example pls? With your help we will solve the problem sooner. Thanks

gioboa avatar Sep 26 '24 15:09 gioboa

@gioboa that example fails on the host example with this error Failed to resolve entry for package "@module-federation/vite". The package may have incorrect main/module/exports specified in its package.json. [plugin externalize-deps

econneely avatar Sep 26 '24 15:09 econneely

I ran pnpm install then pnpm run multi-example

econneely avatar Sep 26 '24 15:09 econneely

I ran pnpm install then pnpm run multi-example

I cloned the repo from scratch and you need to run pnpm run build after the install

gioboa avatar Sep 26 '24 15:09 gioboa

Update the readme with that, it fixed it will get the pr up asap

econneely avatar Sep 26 '24 15:09 econneely

Update the readme with that, it fixed it will get the pr up asap

Fixed, thanks

gioboa avatar Sep 26 '24 16:09 gioboa

Hi any timeframe on this want to know for planning some work with a Vite project thanks

econneely avatar Oct 02 '24 12:10 econneely

I'm on it, I need few days to figure out a solution.

gioboa avatar Oct 02 '24 12:10 gioboa

Thanks much appreciated

econneely avatar Oct 02 '24 12:10 econneely

The idea is to use the @module-federation/dts-plugin because it's always up to date. I'm trying to feed it with a generic compiler. Let's see

gioboa avatar Oct 02 '24 16:10 gioboa

The issue title is "Hotreloading Type Declerations" but isn't it so that not even loading once is supported yet (even without hot reload)? Maybe the issue should be renamed to "Support loading Type Declarations (DTS)" or similar?

I would be happy to initially have even a manual way to generate the @mf-types directory (either with build plugin or even a separate command I can run) and hot relaoding could be added later (if that is more complicated than implementing loading once).

Haprog avatar Jan 16 '25 09:01 Haprog

@Haprog you are right, I changed the title, thanks.


This Vite integration is run by the community even though is under the module federation org so any help is more than welcome 🤗

gioboa avatar Jan 16 '25 12:01 gioboa

Does a branch already exist for this issue?

tduforet avatar Jan 25 '25 20:01 tduforet

Not really, I tried something in my local env without pushing anything. You can start form the main branch.

gioboa avatar Jan 25 '25 20:01 gioboa

As there's been no activity for 30 days, this issue has been flagged as stale. If you'd like it to remain open, please add a comment within the next 7 days. Thank you.

github-actions[bot] avatar Nov 10 '25 19:11 github-actions[bot]