Skip to content

Fix Studio Code syntax error in Node.js 22 - #3885

Merged
fredrikekelund merged 1 commit into
trunkfrom
stu-1857-fix-syntax-node-22
Jun 18, 2026
Merged

Fix Studio Code syntax error in Node.js 22#3885
fredrikekelund merged 1 commit into
trunkfrom
stu-1857-fix-syntax-node-22

Conversation

@fredrikekelund

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Claude was used to help identify and fix the issue.

Proposed Changes

We recently updated to Vite 8 (see #3674 and related PRs). Previously, Vite transformed the JS output to support our targeted Node.js version. It still can, but Vite 8 wasn't picking up the transform target based on our existing config. This PR adds the necessary config to transform the output JS code so Node.js 22 supports it.

All of this is obviously related to Vite 8 swapping out esbuild/Rollup for Rolldown.

Testing Instructions

  1. npm run cli:build
  2. nvm use 22
  3. node apps/cli/dist/cli/main.mjs code
  4. Ensure Studio Code starts

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@fredrikekelund
fredrikekelund requested review from a team, adamziel and youknowriad June 18, 2026 12:10
@fredrikekelund fredrikekelund self-assigned this Jun 18, 2026
@fredrikekelund

Copy link
Copy Markdown
Contributor Author

A quick look at the Vite docs suggests that build.target should be enough, but it clearly isn't in our case.

@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 1d79dd8 vs trunk

app-size

Metric trunk 1d79dd8 Diff Change
App Size (Mac) 2357.80 MB 2357.79 MB 0.00 MB ⚪ 0.0%

site-editor

Metric trunk 1d79dd8 Diff Change
load 1763 ms 1730 ms 33 ms ⚪ 0.0%

site-startup

Metric trunk 1d79dd8 Diff Change
siteCreation 8571 ms 8527 ms 44 ms ⚪ 0.0%
siteStartup 3908 ms 3880 ms 28 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@sejas sejas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good. Thanks for fixing it. I confirm I was able to execute nvm use 22 && node apps/cli/dist/cli/main.mjs code after running nvm use && npm i && npm run cli:build.

We could consider using node 22 CI unit test or similar.

@fredrikekelund

Copy link
Copy Markdown
Contributor Author

We could consider using node 22 CI unit test or similar.

@youknowriad also suggested some smoke tests (in the true "does this thing even work?" sense) that we could run for different Node.js versions. I'll defer to @bcotrim on this, because I think he might be driving changing the E2E test suite to run on the CLI at some point soon

@fredrikekelund
fredrikekelund merged commit 85ba130 into trunk Jun 18, 2026
13 checks passed
@fredrikekelund
fredrikekelund deleted the stu-1857-fix-syntax-node-22 branch June 18, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants