feat: add Rspack 2 runtime foundations and dual-major test infrastructure - #1397
Open
dannyhw wants to merge 5 commits into
Open
feat: add Rspack 2 runtime foundations and dual-major test infrastructure#1397dannyhw wants to merge 5 commits into
dannyhw wants to merge 5 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 7554f51 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This was referenced Jul 6, 2026
dannyhw
commented
Jul 6, 2026
Base automatically changed from
feat/rspack-2-foundations
to
dannyhw/rspack-2-support
July 26, 2026 20:29
Bump @callstack/repack's @rspack/core devDependency to ^2.1.2 (the workspace catalog stays on v1) and absorb the type-level fallout with zero runtime behavior change for Rspack 1 / webpack users: - SwcLoaderOptions became a union discriminated on detectSyntax in v2 - introduce a local non-union SwcConfig alias and split builtin:swc-loader only options off before calling the raw swc transformSync (also more correct at runtime) - narrow devServer before reading .hot in RepackTargetPlugin (the key can be false in v2 types) - rest-destructure devServer off the config in the bundle command instead of delete (not assignable to v2's bundled DevServer type, and unused for bundling) - one documented cast in the start command: Re.Pack's devServer type augmentation and Rspack 2's bundled DevServer type are incompatible solely because each pulls proxy types from a different copy of http-proxy-middleware, and devServer cannot be stripped there because the dev server flow reads it back from compiler.options - getRspackCacheConfig accessor reading the persistent cache config from both the Rspack 1 (experiments.cache) and Rspack 2 (top-level cache) locations, with derived cache types extended for the legacy location @rspack/core v2 is ESM-only which Jest's sandboxed CJS runtime cannot load, so tests now run through a custom test environment that loads the real core outside the sandbox and bridges it back via moduleNameMapper. The environment is parameterized on RSPACK_MAJOR (v2 via import(), v1 via require of the aliased @rspack/core-v1 devDependency), exposes __RSPACK_MAJOR__ for major-gated assertions, and a permanent lane-guard test asserts the loaded major matches the requested lane. CI gains a Rspack 1 unit-suite lane, a Windows lane running the suite under both majors (the require(esm) loading path is Windows-sensitive), and the main-branch Node 18/20 matrix lanes run with RSPACK_MAJOR=1 since Rspack 2 requires Node ^20.19.0 || >=22.12.0. HermesBytecodePlugin test expectations are made platform-agnostic for the Windows lane.
getRspackCacheConfig preferred experiments.cache over the top-level cache option, but a merged or dual-major config can carry both keys (e.g. the experimental cache defaults set experiments.cache while a user config sets top-level cache). Which location is active depends on the installed Rspack major, so --reset-cache now collects both locations instead of picking one.
- unit-test ensureNodeSupportsRspack against mocked rspack/node versions, including the ^20.19.0 || >=22.12.0 range boundaries - assert the rspack commands module registers without loading @rspack/core (a throwing @rspack/core mock fails the suite on any eager load) - assert lazy bundle/start run the guard before importing the command modules and skip them entirely when the guard throws - lower dynamic import() to require() in the jest babel env only; published output keeps import() as-is
dannyhw
force-pushed
the
feat/rspack-2-node-guard
branch
from
July 26, 2026 20:45
649c9e5 to
7554f51
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Combines the remaining Rspack 2 runtime foundations into one review unit:
This PR targets
dannyhw/rspack-2-support, where #1394 has already landed. It is the next prerequisite for the config, cache, and React Refresh work.What changed
startandbundlecommands lazily and route profiling through the shared version helper.resolveProjectPathbehavior at the Windows filesystem root.Detailed review history for the absorbed test-infrastructure slice remains in #1398.
References
agent_context/rspackv2-jul2026/design.mdValidation
The component branches previously passed:
pnpm turbo run typecheck test --force— 17/17 taskspnpm lint:ciThe combined branch will run the same GitHub checks before merging into the feature branch.