Repository navigation
fix(webpack): cap the generated webpack version below 5.111.0 - #37034
Conversation
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.
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
View your CI Pipeline Execution ↗ for commit cc91d4e
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
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:
🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.
🎓 Learn more about Self-Healing CI on nx.dev
…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.
|
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. |
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:CI shows it on unrelated branches: every
e2e-reactmodule 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/enhancedruntime 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
~5.110.0pins fresh installs to the last working line. Existing workspaces keep whatever their lockfile resolved; the generator never overwrites an installed version.@module-federation/enhancedstops reading the template while hashing. Angular module federation still works because@angular-devkit/build-angularpins webpack 5.109.2.View Polygraph session ↗