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

[Bug]: tsserver cannot resolve @modern-js/runtime/mf when tsconfig moduleResolution = Bundler #3106

Open
5 tasks done
yf-yang opened this issue Oct 23, 2024 · 1 comment
Open
5 tasks done

Comments

@yf-yang
Copy link

yf-yang commented Oct 23, 2024

Describe the bug

When using modern.js with module federation and host's tsconfig sets moduleResolution as bunder, @modern-js/runtime/mf could not be correctly resolved by typescript server.

To reproduce:
Open the reproduction in an editor and install packages
Open file modernjs-ssr/host/src/components/dynamic-remote.tsx

Diff of the reproduction:
module-federation/module-federation-examples@81b3fde

File modernjs-ssr/tsconfig.json has overiden the moduleResolution as Bundler, then node_modules/@module-federation/modern-js/types.d.ts is no longer loaded by the tsserver, so package @modern-js/runtime/mf is only resolved to @modern-js/runtime/* (provided by node_modules/@modern-js/app-tools/lib/types.d.ts) and all the symbols provided by @module-federation/modern-js cannot be resolved.

Is there any workaround for this?

Reproduction

https://github.com/yf-yang/module-federation-examples/tree/modernjs-bug

Used Package Manager

pnpm

System Info

Not related

Validations

@yf-yang
Copy link
Author

yf-yang commented Oct 23, 2024

Workaround: instead of import from @modern-js/runtime/mf, import from @module-federation/modern-js/runtime
Documents of module federation suggests @modern-js/runtime/mf, but I don't know why you would prefer such a package alias instead of simply @module-federation/modern-js/runtime.
Not sure if the issue is easy to fix.

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

1 participant