Skip to content

experiment: upgrade to Rspack 2 to test e2e impact#8426

Closed
jacekradko wants to merge 1 commit intomainfrom
jacek/rspack-2-experiment
Closed

experiment: upgrade to Rspack 2 to test e2e impact#8426
jacekradko wants to merge 1 commit intomainfrom
jacek/rspack-2-experiment

Conversation

@jacekradko
Copy link
Copy Markdown
Member

Do not merge. Sandbox to test whether upgrading from Rspack 1.7.x → 2.0.0 fixes the consistently-failing express / hono / generic / nextjs / billing / machine integration suites.

The previous experiment (#8425, now closed) was reverting the rspack pin — but that pin was a fix for an earlier rspack regression and shouldn't be reverted. This branch goes the other direction: upgrades to Rspack 2 (the current ecosystem version) on top of latest `main` (Node 24, auto-proxy, etc.).

Sibling experiments still up:

Will be closed regardless of outcome.

Bumps the Rspack catalog to 2.0.0 and applies the migration:
- Node minimum bumped to 22.12.0 (Rspack 2 requirement)
- Convert clerk-js rspack.config.js to .mjs (Rspack 2 core is pure ESM)
- Rename output.libraryTarget to output.library.type (8 sites)
- Move experiments.cache to top-level cache
- Drop --analyze CLI flag (removed in v2; Rsdoctor remains for analysis)
- Bump @rsdoctor/rspack-plugin to 1.5.x
- Add @rspack/dev-server as a direct dep (no longer bundled with @rspack/cli)

Both packages build green across all variants.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 30, 2026

🦋 Changeset detected

Latest commit: 54e600e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@clerk/clerk-js Patch
@clerk/ui Patch
@clerk/chrome-extension Patch
@clerk/expo Patch

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

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 2026

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Apr 30, 2026 4:02am

Request Review

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 30, 2026

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@8426

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@8426

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@8426

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@8426

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@8426

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@8426

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@8426

@clerk/express

npm i https://pkg.pr.new/@clerk/express@8426

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@8426

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@8426

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@8426

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@8426

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@8426

@clerk/react

npm i https://pkg.pr.new/@clerk/react@8426

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@8426

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@8426

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@8426

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@8426

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@8426

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@8426

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@8426

commit: 54e600e

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

📝 Walkthrough

Walkthrough

This pull request upgrades the Rspack build toolchain from v1.7.x to v2.0.0 across the monorepo. Changes include upgrading core Rspack dependencies in pnpm-workspace.yaml, migrating clerk-js's rspack config from CommonJS to ESM format (renamed to .mjs), updating deprecated Rspack configuration APIs (converting output.libraryTarget to output.library.type and experiments.cache to top-level cache config), adding @rspack/dev-server as a shared devDependency, upgrading @rsdoctor/rspack-plugin to v1.5.9, and updating build scripts and task inputs to reference the new config file paths.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main objective: upgrading to Rspack 2 as an experimental sandbox to test impact on failing test suites.
Description check ✅ Passed The description clearly explains the PR's purpose: testing whether Rspack 2 upgrade fixes failing integration tests, references related experiments, and explicitly marks it as not-for-merge.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Review rate limit: 2/5 reviews remaining, refill in 31 minutes and 21 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pnpm-workspace.yaml`:
- Around line 50-51: Remove the stale minimumReleaseAge bypass by deleting the
excluded entry '@rspack/*' from the pnpm workspace excludes list (the TODO above
it can also be removed), so the workspace no longer excludes `@rspack` packages
and reduces unnecessary supply-chain risk.
- Around line 24-27: The Node engine fields in packages/ui/package.json and
packages/clerk-js/package.json are too permissive ("engines": { "node":
">=20.9.0" }) given the bump of `@rspack/`* to 2.0.0 (which requires Node 20.19+
or 22.12+); update the "engines" node requirement in both package manifests to
at least ">=20.19.0" (or change both to match the project's stricter root
policy, e.g., ">=24.15.0") so installs won't pass on runtimes that will fail
when rspack runs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 0211ff4c-e591-4bd5-8d00-92577e409af8

📥 Commits

Reviewing files that changed from the base of the PR and between 61e0a78 and 54e600e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • .changeset/rspack-2-upgrade.md
  • packages/clerk-js/package.json
  • packages/clerk-js/rspack.config.mjs
  • packages/clerk-js/turbo.json
  • packages/ui/package.json
  • packages/ui/rspack.config.js
  • pnpm-workspace.yaml

Comment thread pnpm-workspace.yaml
Comment on lines +24 to +27
'@rspack/cli': 2.0.0
'@rspack/core': 2.0.0
'@rspack/dev-server': 2.0.0
'@rspack/plugin-react-refresh': 2.0.0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

What is the minimum supported Node.js version for @rspack/core2.0.0 and@rspack/cli 2.0.0?

💡 Result:

The minimum supported Node.js version for both @rspack/core 2.0.0 and @rspack/cli 2.0.0 is Node.js 20.19+ or 22.12+.

Citations:


🏁 Script executed:

# Find and display the package.json files mentioned in the review
find . -type f -name "package.json" | grep -E "(packages/ui|packages/clerk-js)" | head -5

Repository: clerk/javascript

Length of output: 120


🏁 Script executed:

# Check the Node version requirement in packages/ui/package.json
if [ -f "packages/ui/package.json" ]; then
  echo "=== packages/ui/package.json ===" && \
  grep -A 2 '"engines"' packages/ui/package.json || echo "No engines field found"
fi

Repository: clerk/javascript

Length of output: 136


🏁 Script executed:

# Check the Node version requirement in packages/clerk-js/package.json
if [ -f "packages/clerk-js/package.json" ]; then
  echo "=== packages/clerk-js/package.json ===" && \
  grep -A 2 '"engines"' packages/clerk-js/package.json || echo "No engines field found"
fi

Repository: clerk/javascript

Length of output: 142


🏁 Script executed:

# Check if these packages depend on `@rspack` packages
echo "=== Checking `@rspack` dependencies in packages/ui/package.json ===" && \
grep -E '"@rspack' packages/ui/package.json 2>/dev/null || echo "No `@rspack` deps found" && \
echo && \
echo "=== Checking `@rspack` dependencies in packages/clerk-js/package.json ===" && \
grep -E '"@rspack' packages/clerk-js/package.json 2>/dev/null || echo "No `@rspack` deps found"

Repository: clerk/javascript

Length of output: 545


🏁 Script executed:

# Check the root package.json and pnpm-workspace.yaml for context
echo "=== pnpm-workspace.yaml (lines 20-35) ===" && \
sed -n '20,35p' pnpm-workspace.yaml && \
echo && \
echo "=== Root package.json engines ===" && \
grep -A 2 '"engines"' package.json 2>/dev/null || echo "No engines in root package.json"

Repository: clerk/javascript

Length of output: 658


Node support contract is inconsistent with the Rspack 2 upgrade.

Line 24–27 upgrades @rspack/* to 2.0.0, which requires Node.js 20.19+ or 22.12+. However, packages/ui/package.json and packages/clerk-js/package.json specify "engines": { "node": ">=20.9.0" }. Both packages use catalog:rspack references, so they will pull 2.0.0 from the workspace catalog. This creates a compatibility gap: Node 20.9.0–20.18.x will pass install checks but fail at runtime when Rspack executes. Update the engine requirements in both packages to >=20.19.0 (or align with the root policy of >=24.15.0 if appropriate).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pnpm-workspace.yaml` around lines 24 - 27, The Node engine fields in
packages/ui/package.json and packages/clerk-js/package.json are too permissive
("engines": { "node": ">=20.9.0" }) given the bump of `@rspack/`* to 2.0.0 (which
requires Node 20.19+ or 22.12+); update the "engines" node requirement in both
package manifests to at least ">=20.19.0" (or change both to match the project's
stricter root policy, e.g., ">=24.15.0") so installs won't pass on runtimes that
will fail when rspack runs.

Comment thread pnpm-workspace.yaml
Comment on lines +50 to +51
# TODO: remove once rspack 2.0.0 is >48h old (published 2026-04-22)
- '@rspack/*'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove the stale @rspack/* minimumReleaseAge bypass.

Line 50 says this should be removed once Rspack 2.0.0 is older than 48h (published 2026-04-22). As of April 30, 2026, that condition is already met. Keeping @rspack/* excluded broadens supply-chain risk unnecessarily.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pnpm-workspace.yaml` around lines 50 - 51, Remove the stale minimumReleaseAge
bypass by deleting the excluded entry '@rspack/*' from the pnpm workspace
excludes list (the TODO above it can also be removed), so the workspace no
longer excludes `@rspack` packages and reduces unnecessary supply-chain risk.

@jacekradko
Copy link
Copy Markdown
Member Author

Closing — the same 5 express tests (and same hono/billing/etc. patterns) fail identically on this branch as on main. upgrading to Rspack 2 does not fix the userButton mount regression. Pattern is consistent across all four candidate branches we tested (#8422, #8423, #8424, #8426), so the cause is environmental, not in the JS source. Refocusing on infra: Clerk dashboard config on the test instances, FAPI deploys, Blacksmith runner image, or pnpm/Playwright resolution drift.

@jacekradko jacekradko closed this Apr 30, 2026
@jacekradko jacekradko deleted the jacek/rspack-2-experiment branch April 30, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant