fix(webpack): cap less version to <4.6.0 to avoid ESM incompatibility#34781
fix(webpack): cap less version to <4.6.0 to avoid ESM incompatibility#34781FrozenPandaz merged 6 commits intomasterfrom
Conversation
less@4.6.0 switched to ESM ("type": "module"), which breaks
less-loader@11.x that uses require() to load it, causing
"Class extends value undefined is not a constructor or null" errors.
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
View your CI Pipeline Execution ↗ for commit 7f4af00
☁️ Nx Cloud last updated this comment at |
ba519d0 to
cdd5091
Compare
…r-rspack - Add missing `less` dependency (capped <4.6.0) to @nx/rspack and @nx/angular-rspack - Bump less-loader to ^12.2.0 for @nx/rspack (already done for webpack and angular-rspack) - Bump root less-loader pin to 12.2.0
…ular-rspack Both packages use less-loader which requires less at runtime. Add less (capped <4.6.0 for ESM compat) and configure eslint dependency-checks to ignore it.
less is a peer dep of less-loader, so consumers provide it. Only @nx/webpack ships it as a convenience direct dep.
b1b7363 to
58b3c65
Compare
Bump root less pin to latest CJS-compatible version. Remove less-loader from rspack eslint ignoredDependencies since dependency-checks detects require.resolve usage.
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 were unable to attribute this failure to the PR's code changes. The test fails during Playwright browser installation due to a hash sum mismatch when fetching Google Chrome's package list from dl.google.com — a transient external CDN issue unrelated to the less version capping introduced here. Our recommendation is to re-run the pipeline once Google's package repository has re-synced.
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
|
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/webpackspecifies"less": "^4.1.3"as a dependency, which allowsless@4.6.0to be installed. However,less@4.6.0switched to ESM ("type": "module"), andless-loader@11.xusesrequire()to load it. This causes a runtime error:This breaks any React/webpack project that uses Less stylesheets (e.g. the "should support global and css modules" e2e test).
Expected Behavior
The
lessversion range is capped to>=4.1.3 <4.6.0, preventing the incompatible ESM-only version from being installed. Less stylesheets compile correctly with webpack and less-loader.Related Issue(s)
N/A - discovered via e2e test failure