Open yf-yang opened 2 weeks ago
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.
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: https://github.com/module-federation/module-federation-examples/commit/81b3fdefed6928d5449b0972fb52c5182c50b7f0
File
modernjs-ssr/tsconfig.json
has overiden the moduleResolution asBundler
, thennode_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 bynode_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
Validations