Skip to content

feat: add rspack version detection helpers#1394

Open
dannyhw wants to merge 1 commit into
mainfrom
feat/rspack-2-foundations
Open

feat: add rspack version detection helpers#1394
dannyhw wants to merge 1 commit into
mainfrom
feat/rspack-2-foundations

Conversation

@dannyhw

@dannyhw dannyhw commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Second PR of the Rspack 2 support stack split out of #1393 (design doc in #1395). Deliberately minimal — pure utilities, nothing wired up yet:

  • helpers/rspackVersion.ts: getRspackVersion / getRspackMajorVersion / isRspack2 resolve the installed @rspack/core version via its package.json without importing the package — safe on any Node version (@rspack/core@2 is ESM-only and cannot be require()d on Node < 20.19) and safe when rspack isn't installed (webpack-only projects). getRspackMajorVersionFromCompiler covers plugin contexts via compiler.webpack.rspackVersion.
  • ConfigKeys additions (cache, experiments) in commands/types.ts — type-only; describes config keys the commands already read.

No behavior change, no dependency changes, no changeset. Consumers arrive with the follow-up PRs:

  1. docs: add rspack 2 dual-version support design doc #1395 — design doc (independent)
  2. This PR — version utilities
  3. Node ≥20.19 guard for Rspack 2 + lazy command loading (clear error instead of ERR_REQUIRE_ESM)
  4. @rspack/core@^2 devDep + type fallout + dual-major jest lane + CI lanes (Rspack 1 + Windows)
  5. Then in parallel: config routing, legacy-cache warning, MFv1 runtime-tools pre-check, React Refresh restructure; closed by a dual-major smoke suite (headline changeset) and per-major tester apps

Everything here was previously reviewed as part of #1393; the branch there stays as the reference implementation until the stack lands.

Verification

  • turbo run typecheck test --force — 17/17 tasks green (repack 280/280)
  • biome check — clean

@changeset-bot

changeset-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 81936bb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel

vercel Bot commented Jul 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
repack-website Ready Ready Preview, Comment Jul 3, 2026 10:43pm

Request Review

Comment thread .github/workflows/test.yml Fixed
Comment thread .github/workflows/test.yml Fixed
@dannyhw dannyhw force-pushed the feat/rspack-2-foundations branch from 9b5229f to 89f3c09 Compare July 3, 2026 22:11
@dannyhw dannyhw force-pushed the feat/rspack-2-foundations branch from 89f3c09 to 7cbf8b8 Compare July 3, 2026 22:38
@dannyhw dannyhw changed the title feat: build and test against rspack 2 alongside rspack 1 (foundations) feat: add rspack version detection helpers + rspack 2 adoption plan docs Jul 3, 2026
Utilities for the upcoming dual rspack-major support (see
agent_context/rspackv2-jul2026/): getRspackVersion / getRspackMajorVersion /
isRspack2 resolve @rspack/core/package.json without importing the package -
safe on any Node version (@rspack/core@2 is ESM-only and cannot be
require()d on Node < 20.19) and safe when rspack is not installed
(webpack-only projects). getRspackMajorVersionFromCompiler covers plugin
contexts via compiler.webpack.rspackVersion.

ConfigKeys additions (cache, experiments) describe config keys the
commands already read.

No behavior change; nothing consumes the helpers yet.
@dannyhw dannyhw force-pushed the feat/rspack-2-foundations branch from 7cbf8b8 to 81936bb Compare July 3, 2026 22:42
@dannyhw dannyhw changed the title feat: add rspack version detection helpers + rspack 2 adoption plan docs feat: add rspack version detection helpers Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants