feat: warn about legacy experiments.cache config under rspack 2#1399
Open
dannyhw wants to merge 4 commits into
Open
feat: warn about legacy experiments.cache config under rspack 2#1399dannyhw wants to merge 4 commits into
dannyhw wants to merge 4 commits into
Conversation
Rspack 2 moved persistent cache configuration from `experiments.cache` to the top-level `cache` option and silently ignores the legacy key - users migrating a Rspack 1 config would lose persistent caching without any signal. Emit a one-time actionable warning from the rspack start/bundle commands when running under Rspack 2 with a legacy `experiments.cache` value, pointing at the top-level `cache` option. The config is left untouched: migrating it is the user's move, and mutating it would make Re.Pack behave differently from bare Rspack given the same config.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 625c696 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
dannyhw
left a comment
Collaborator
Author
There was a problem hiding this comment.
codex review: I reviewed this against the stacked base branch feat/rspack-2-types-test-infra. I’m leaving the concrete issues inline.
The warning claimed persistent caching is NOT enabled whenever
'experiments.cache' was present, which is false for a migrated config
that sets top-level 'cache: { type: 'persistent' }' and only leaves the
inert legacy key behind. Gate the warning on the top-level persistent
cache being absent in the same config, and cover the helper with a test
matrix (legacy-only, typical Rspack 1 shape with 'cache: true',
memory-only top-level cache, migrated leftover key, multi-config, and
the once-only latch).
This comment has been minimized.
This comment has been minimized.
This was referenced Jul 6, 2026
dannyhw
commented
Jul 7, 2026
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.
Part of the Rspack 2 support PR stack (reference implementation: #1393, design doc:
agent_context/rspackv2-jul2026/design.md).What
Emits a one-time warning from the rspack
start/bundlecommands when running under Rspack 2 with a legacyexperiments.cachevalue in the config, pointing the user at the top-levelcacheoption. The config is left untouched — no value is copied or deleted.Why
Rspack 2 moved persistent cache configuration from
experiments.cacheto the top-levelcacheoption and silently ignores the legacy key (validation is loose). A user migrating a Rspack 1 config would lose persistent caching with no signal at all.Warn-only (rather than auto-migrating the value) follows the explicit maintainer guidance on #1393: users migrate their own config, and mutating it at runtime would make Re.Pack behave differently from bare Rspack given the same config. This behavior was verified against the built dist on the reference branch: warns exactly once, config untouched.
Changes
commands/common/warnLegacyRspackCacheConfig.ts(new) — the one-time warning, keyed off theRspackConfigurationWithLegacyCachetype introduced with the cache accessorcommands/common/index.ts— exportcommands/rspack/start.ts/bundle.ts— call sites only, gated onisRspack2; the diff is kept to the minimal wiring (the helper lives incommands/common/so it could serve a webpack counterpart if one ever existed, per the command-path-convergence feedback on feat: support Rspack 2 alongside Rspack 1 - reference implementation (to be broken down) #1393).changeset/rspack-2-cache-warning.md— patch changesetStack position
Parallel set — based on PR 2c (#1398) ← 2b (#1397) ← 2a (#1394). No shared files with the other parallel-set PRs (this is the only one touching
start.ts/bundle.ts).Validation
pnpm turbo run typecheck test --force— 17/17 tasks greenpackages/repack:pnpm testandpnpm test:rspack1— 282/282 under both Rspack majorspnpm lint:ci— clean