Summary
Rspack v2 (breaking changes) is in beta (currently v2.0.0-beta.6). We should add rspack v2 support while keeping v1 compatibility, so users aren't forced to upgrade rspack just to get the latest shakapacker.
No source code changes are needed — shakapacker's rspack integration doesn't use any of the 30+ APIs removed or changed in v2. This is purely a version range + test + docs update.
Breaking Changes Impact Analysis
High Impact: Pure ESM Package
@rspack/core and @rspack/cli v2 are pure ESM packages (no CJS builds). Shakapacker compiles to CJS and uses require() to load rspack.
Mitigation: Node 20.19.0+ natively supports require() of synchronous ESM modules. Since rspack v2 itself requires Node 20.19.0+, this is a non-issue for users — our require() calls continue to work without code changes.
Jest impact: Jest's CJS runtime can't require() ESM packages, so rspack integration tests need requireOrError mocks (consistent with the pattern already used in other rspack test files).
Medium Impact: Dependency Version Ranges
- Peer deps:
@rspack/core and @rspack/cli change from ^1.0.0 to ^1.0.0 || ^2.0.0-0
- Dev deps: pinned to
2.0.0-beta.6 for CI testing
@rspack/plugin-react-refresh stays at v1.x (no v2 releases)
rspack-manifest-plugin already supports rspack v2
No Impact (30+ breaking changes reviewed)
None of the removed/changed APIs are used by shakapacker:
| Change |
Why No Impact |
experiments.SubResourceIntegrityPlugin removed |
We use rspack.SubresourceIntegrityPlugin (top-level) |
| Node 18 dropped |
Already require Node >= 20 |
experiments.rspackFuture removed |
Not used |
output.charset removed |
Not used |
WarnCaseSensitiveModulesPlugin removed |
Not used |
getHooks() removed from plugins |
Not used |
LightningCSS draft option removed |
No options passed to minimizer |
Deprecated output.library fields removed |
Not used in generated config |
stats.profile / profile removed |
Not used |
experiments.outputModule removed |
Not used |
| Default devtool changed |
Shakapacker explicitly sets devtool |
| Default chunk/hot-update globals renamed |
Not referenced in code |
.swcrc reading disabled |
Not relied upon |
exportsPresence default → 'error' |
User-facing (stricter builds), not a shakapacker code change |
Implementation Checklist
Summary
Rspack v2 (breaking changes) is in beta (currently v2.0.0-beta.6). We should add rspack v2 support while keeping v1 compatibility, so users aren't forced to upgrade rspack just to get the latest shakapacker.
No source code changes are needed — shakapacker's rspack integration doesn't use any of the 30+ APIs removed or changed in v2. This is purely a version range + test + docs update.
Breaking Changes Impact Analysis
High Impact: Pure ESM Package
@rspack/coreand@rspack/cliv2 are pure ESM packages (no CJS builds). Shakapacker compiles to CJS and usesrequire()to load rspack.Mitigation: Node 20.19.0+ natively supports
require()of synchronous ESM modules. Since rspack v2 itself requires Node 20.19.0+, this is a non-issue for users — ourrequire()calls continue to work without code changes.Jest impact: Jest's CJS runtime can't
require()ESM packages, so rspack integration tests needrequireOrErrormocks (consistent with the pattern already used in other rspack test files).Medium Impact: Dependency Version Ranges
@rspack/coreand@rspack/clichange from^1.0.0to^1.0.0 || ^2.0.0-02.0.0-beta.6for CI testing@rspack/plugin-react-refreshstays at v1.x (no v2 releases)rspack-manifest-pluginalready supports rspack v2No Impact (30+ breaking changes reviewed)
None of the removed/changed APIs are used by shakapacker:
experiments.SubResourceIntegrityPluginremovedrspack.SubresourceIntegrityPlugin(top-level)experiments.rspackFutureremovedoutput.charsetremovedWarnCaseSensitiveModulesPluginremovedgetHooks()removed from pluginsdraftoption removedoutput.libraryfields removedstats.profile/profileremovedexperiments.outputModuleremoved.swcrcreading disabledexportsPresencedefault →'error'Implementation Checklist
@rspack/coreand@rspack/clito^1.0.0 || ^2.0.0-0requireOrErrormocks for ESM-only@rspack/core