Skip to content

fix(react): add .js extensions to subpath imports in module federation templates #31730

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

Merged
merged 2 commits into from
Jun 26, 2025

Conversation

Coly010
Copy link
Contributor

@Coly010 Coly010 commented Jun 25, 2025

Current Behavior

Module federation templates in React generators use subpath imports
without explicit file extensions (e.g., @nx/rspack/app-plugin,
@nx/module-federation/webpack). This causes compatibility issues with
Node.js 24's native TypeScript support, which requires explicit file
extensions for ESM package subpath imports.

Expected Behavior

Module federation templates should include .js extensions on all subpath
imports to ensure compatibility with Node.js 24 while maintaining
backwards compatibility with earlier Node.js versions. The imports
should be in the format @nx/rspack/app-plugin.js,
@nx/module-federation/webpack.js, etc.

Related Issue(s)

Fixes #31448

…n templates

Node.js 24's native TypeScript support requires explicit file extensions for ESM package subpath imports. This change updates rspack and webpack module federation templates to include .js extensions for compatibility.

- Updated rspack module federation templates (host and remote)
- Updated webpack module federation templates (host and remote)
- Ensures compatibility with Node.js 24 while maintaining backwards compatibility

Fixes #31448
@Coly010 Coly010 requested review from a team as code owners June 25, 2025 15:45
@Coly010 Coly010 requested a review from jaysoo June 25, 2025 15:45
@Coly010 Coly010 self-assigned this Jun 25, 2025
Copy link

vercel bot commented Jun 25, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview Jun 26, 2025 10:24am

Copy link

nx-cloud bot commented Jun 25, 2025

View your CI Pipeline Execution ↗ for commit 4f9d7b1.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 4m 19s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 16s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 4s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 3s View ↗
nx documentation ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2025-06-26 10:20:13 UTC

@Coly010 Coly010 merged commit 71d60a9 into master Jun 26, 2025
8 checks passed
@Coly010 Coly010 deleted the 31448-generate-template-ext branch June 26, 2025 12:22
Copy link

github-actions bot commented Jul 2, 2025

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nx + React + Rspack + Module Federation doesn't build fresh
2 participants