Repository navigation
fix(core): evict the bundler persistent cache when the target browsers, the server Node.js target or plugin versions change (AI-assisted) - #12774
Conversation
✅ [V2]
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Size Change: 0 B Total Size: 12.1 MB ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 12.1 MB ℹ️ View Unchanged
|
⚡️ Lighthouse report for the deploy preview of this PR
|
9768480 to
31bd2b8
Compare
31bd2b8 to
bebc8aa
Compare
…s, the server Node.js target or plugin versions change (AI-assisted) The persistent cache doesn't track loader options, so getCacheVersion() must include what they're computed from: - The targets from the new getTargets(): the browsers the client queries match, instead of the queries. The same queries (like "baseline widely available") can match other browsers over time or after a Browserslist data upgrade. For the server cache, the server targets (current Node.js version or DOCUSAURUS_SERVER_NODE_TARGET). - The plugin versions: upgrading a third-party plugin can change the loader options it computes without changing any build dependency. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bebc8aa to
56ded34
Compare
Motivation
Webpack and Rspack key their persistent cache entries by the rule position of a loader, not by its option values. When a loader option changes without a build dependency file changing, the bundler reuses stale output.
getCacheVersion()must include what the loader options are computed from.Builds on #12778, which separates the client queries from the client and server targets.
This PR follows #12727, which added the client Browserslist queries to the cache version:
baseline widely available) can match other browsers over time or after a Browserslist data upgrade. Rewriting a query that matches the same browsers no longer evicts the cache.DOCUSAURUS_SERVER_NODE_TARGET). Switching Node.js versions used to reuse server modules compiled for the previous one. The server cache no longer depends on the client Browserslist config, which neither SWC nor Babel uses for server code. These targets aren't Browserslist queries, so they're hashed as they are: Browserslist doesn't know all the Node.js patch releases they can contain.configureWebpack()orconfigurePostCss()without changing any build dependency. The cache version now includessiteMetadata.pluginVersions. The site's ownpackage.jsonversion is left out.All the values are now hashed together, as a single array.
@docusaurus/bundlerexports a newgetTargets({isServer, bundlerName}), returning the client or server targets. Core no longer uses thegetClientQueriesexport, but I kept it because entry point exports are public API.Test Plan
Unit tests in
base.test.ts. The cache version:With the previous
getCacheVersion(), 3 of these tests fail.The time drift of queries like
baseline widely availableisn't tested: Browserslist caches query results within a process, so a test can't fake the date.Test links
Deploy preview: https://deploy-preview-12774--docusaurus-2.netlify.app/
Related issues/PRs
clientBrowserslistQueriesparam (AI-assisted) #12778🤖 Generated with Claude Code