vite icon indicating copy to clipboard operation
vite copied to clipboard

example: Hotreloading Type Declerations

Open econneely opened this issue 1 year ago • 6 comments

Repo example for #112 Docs here https://module-federation.io/configure/dts.html

Expected a the host to generate a @mf-types/ as described in here https://module-federation.io/guide/basic/type-prompt.html

econneely avatar Sep 26 '24 17:09 econneely

The @module-federation/enhanced is doing

if (options.dts !== false) {
  new DtsPlugin(options).apply(compiler);
}

so I think we need to do the same

gioboa avatar Sep 27 '24 10:09 gioboa

We can't use new DtsPlugin(options).apply(compiler); because from my understanding apply needs a Webpack compiler. @ScriptedAlchemy is it correct?

gioboa avatar Sep 27 '24 13:09 gioboa

Yes, but the DTS manager itself is agnostic and could be implemented in other bundlers.

ScriptedAlchemy avatar Sep 30 '24 05:09 ScriptedAlchemy

My colleague is on leave this week, but he understands the DTS system best. It's quite intricate, but there's a DTS manager that should create a separate server for handling type requests and builds. We can also register dynamic remote types from the browser by sending the data back to the DTS server, which then generates the discovered types. It shouldn't be tightly coupled to any bundler, but it still has a few moving parts.

ScriptedAlchemy avatar Oct 04 '24 00:10 ScriptedAlchemy

My colleague is on leave this week, but he understands the DTS system best. It's quite intricate, but there's a DTS manager that should create a separate server for handling type requests and builds. We can also register dynamic remote types from the browser by sending the data back to the DTS server, which then generates the discovered types. It shouldn't be tightly coupled to any bundler, but it still has a few moving parts.

I'm creating a "generic compiler" that is implementing all the methods needed :wink:

gioboa avatar Oct 04 '24 07:10 gioboa

Perfect. You can send a pr back to core if additional changes or packages need to be created for dts to support other tools

ScriptedAlchemy avatar Oct 06 '24 23:10 ScriptedAlchemy

Hello does closing this branch mean that the vite tool wont be getting remote type hints?

danielBence avatar Feb 13 '25 07:02 danielBence

Hello does closing this branch mean that the vite tool wont be getting remote type hints?

Nope, I really would like to support this feature but I need an help from the official mf team. You can drop a PR for this if you like, I'm more than happy to collaborate. Thanks

gioboa avatar Feb 13 '25 08:02 gioboa