module-federation / vite

Vite Plugin for Module Federation
MIT License
346 stars 30 forks source link

no support for sharing monorepo aliases #213

Open DanielSegal1 opened 6 hours ago

DanielSegal1 commented 6 hours ago

Hey, Recently, when trying to shift from originjs's plugin to this one, I stumbled across an issue. Im using nx, and Im trying to share from my app, a "core" library I also have in the monorepo. In nx, I have alias for the library, and instead of importing 'lib-name' I use '@monorepo-name/lib-name'. (The reason for that is that it lets me not needing to publish and install the packages that I maintain inside the monorepo) The package Im sharing this to (lets name it 'federated-lib') is in the repo, and it is too, using the core library with the aliasing.

I'm currently using originjs's federation plugin and it works great but when trying to switch to this plugin I get an error of something along the lines of 'module @monorepo-name/lib-name/package.json not found'.

I tried whatever I can, fiddling around with the aliasing in the tsconfig but had no luck. Would be glad to hear from you what I should be doing because this blocks me from upgrading to this plugin.

Also, unfortunately I wouldn't be able to share the code as it is company private. Thanks for any help.

gioboa commented 6 hours ago

Hi @DanielSegal1 I see, can you create a basic example that reproduce your scenario? This will help us to debug the problem. Thanks