Skip to content

fix(webpack): cap the generated webpack version below 5.111.0 - #37034

Merged
leosvelperez merged 1 commit into
masterfrom
fix/mf-webpack-5-111-contenthash
Sep 14, 2026
Merged

leosvelperez merged 1 commit into
masterfrom
fix/mf-webpack-5-111-contenthash

Conversation

@leosvelperez

@leosvelperez leosvelperez commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

Current Behavior

Nx generators write webpack: ^5.101.3, so a fresh workspace installs webpack 5.111.0 (released 2026-09-14). Every module federation production build then fails:

ERROR in webpack/runtime/federation runtime
Path variable [contenthash:20] not implemented in this context: [name].[contenthash:20].js

CI shows it on unrelated branches: every e2e-react module federation webpack suite fails this way in this run and this run.

webpack 5.111.0 fails the build when hashing a runtime module throws; earlier versions swallowed that error (webpack/webpack#22034). The @module-federation/enhanced runtime module reads the chunk filename template at that point. Content hashes do not exist yet, so the lookup throws and the build fails. The same config builds on 5.110.0.

Expected Behavior

Fresh workspaces install webpack 5.110.x and module federation production builds pass.

Implementation Notes

  • The failing call sits inside the module federation runtime module. Nx cannot skip it from its plugin, so capping the generated range is the only fix on the Nx side.
  • ~5.110.0 pins fresh installs to the last working line. Existing workspaces keep whatever their lockfile resolved; the generator never overwrites an installed version.
  • Lift the cap once @module-federation/enhanced stops reading the template while hashing. Angular module federation still works because @angular-devkit/build-angular pins webpack 5.109.2.

View Polygraph session ↗

Fresh workspaces installed webpack 5.111.0 (released 2026-09-14) and every
module federation production build failed with "Path variable
[contenthash:20] not implemented in this context".

webpack/webpack#22034 (5.111.0) stopped swallowing an error thrown while a
runtime module is hashed. The @module-federation/enhanced runtime module
resolves the chunk filename template at that point, before content hashes
exist, so the lookup throws and now fails the build. The same config builds
on 5.110.0, and the failing call is inside the module federation runtime
module, so Nx cannot avoid it from its plugin.

Pin fresh installs to ~5.110.0 until @module-federation/enhanced stops
resolving the template during hashing. Existing workspaces keep whatever
their lockfile resolved.
@netlify

netlify Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit cc91d4e
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/6aa7dfa2c543f900072243c6
😎 Deploy Preview https://deploy-preview-37034--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit cc91d4e
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/6aa7dfa271d476000879850d
😎 Deploy Preview https://deploy-preview-37034--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@leosvelperez leosvelperez self-assigned this Sep 14, 2026
@nx-cloud

nx-cloud Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit cc91d4e

Command Status Duration Result
nx affected --targets=lint,oxlint,test,build,e2... ✅ Succeeded 9m 49s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3s View ↗
nx-cloud record -- pnpm nx-cloud conformance:check ✅ Succeeded 43s View ↗
nx build workspace-plugin ✅ Succeeded <1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 17s View ↗
nx-cloud record -- nx format:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-09-14 13:14:45 UTC

@nx-cloud nx-cloud Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

Nx Cloud has identified a possible root cause for your failed CI:

We classified this failure as an environment issue unrelated to the PR. The e2e setup fails because @rspack/[email protected] is not yet available in the local Verdaccio registry (only 2.2.3 is present), which prevents @nx/[email protected] from being installed. This PR only caps the webpack version and has no connection to the rspack dependency resolution failure.

No code changes were suggested for this issue.

Trigger a rerun:

Rerun CI

Nx Cloud View detailed reasoning on Nx Cloud ↗

🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.


🎓 Learn more about Self-Healing CI on nx.dev

@leosvelperez
leosvelperez marked this pull request as ready for review September 14, 2026 13:15
@leosvelperez
leosvelperez requested a review from a team as a code owner September 14, 2026 13:15
@leosvelperez
leosvelperez merged commit a876d5b into master Sep 14, 2026
28 of 29 checks passed
@leosvelperez
leosvelperez deleted the fix/mf-webpack-5-111-contenthash branch September 14, 2026 13:25
AgentEnder added a commit that referenced this pull request Sep 17, 2026
…ion builds

webpack 5.111.0 fails federation builds with "Path variable [contenthash:20]
not implemented in this context" (webpack/webpack#22034). Master pins the
version the webpack init generator writes into a workspace (#37034); this
branch's generator did not add webpack at all, so a new workspace took
whatever @nx/webpack, @nx/module-federation or @nx/rspack resolved.

The generator now adds `webpack: ~5.110.0`, and the three packages that
depend on webpack cap it below 5.111.0 for workspaces that never ran init.
The lockfile already resolved a version inside the cap, so only its
specifier lines change.
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

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 Oct 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants