-
Notifications
You must be signed in to change notification settings - Fork 17
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
Using federated apps' types in host app #4
Comments
Hi @Kjaer, thanks for posting a question! Are you using a mono-repo - where your remote and host application packages are in the same project and leverage something like Lerna or Yarn Workspaces to consolidate dependencies across your project? If so, I think For the generated typing file to recognized by the TS compiler, it will need to be in a place the compiler knows to find types. The location that works for us is somewhere in the
outputDir example
I hope that helps. Let me know if you need more help. |
Hey @gthmb
Yes I am, but haven't set
I am exporting my typings inside a custom scripts: {
"make-types": "make-federated-types --outputDir ./@types/remote-app"
} but Then on my host app. I add these typings a a dependency on package.json. devDependencies: {
"@types/remote-app": "file:../federated-apps/remote-app/@types/remote-app",
} Then I install the deps for the host app and all my remote-app's typings available on host app. only path of the typings are hard-coded but I think it's fair trade-off. What do you think? |
Hey @Kjaer. That will certainly work. I suspect the reason you are writing your types to your own |
That's right! All the packages under the monorepo has its own node_modules. They don't share the dependencies accross the packages. |
But even though I used the |
I'm gonna close this issue. Let me know if you think it should be re-opened. Thanks! |
Hey there @gthmb,
I am coming from this discussion → module-federation/module-federation-examples#20
I would like ask how remote apps' types can be included of host apps' scope?
let me illustrate my question with an example
The files below belong to my
remote app
, meaning I am gonna use this app as dependant into myhost app
and this my
bootstrap
fileThe files below belong to my
host app
and now I want is injecting my
remote app
inside thehost app
When I ran my
yarn start
command for the host app, I am getting this error:Apperantly My types are available only for my
remote app
and I am curious how may I move those generated remote apps' types intohost app
scope and makets-loader
happy.The text was updated successfully, but these errors were encountered: