Skip to content

fix(samples): make the vite config ESM so it loads on the sandbox Node - #139

Merged
gaelsimon merged 1 commit into
masterfrom
fix/vite-config-esm
Sep 4, 2026
Merged

fix(samples): make the vite config ESM so it loads on the sandbox Node#139
gaelsimon merged 1 commit into
masterfrom
fix/vite-config-esm

Conversation

@gaelsimon

Copy link
Copy Markdown
Member

With Vite pinned back to 7, samples still died in CodeSandbox: vite.config.js is ESM but the sample has no "type": "module", so Node treats it as CommonJS and tries to require() Vite's ESM entry. That only works from Node 20.19, and the sandbox runs 20.12.1 — hence ERR_REQUIRE_ESM.

Generating vite.config.mjs instead makes Node load it as ESM natively, on any version. The oxc block goes with it: it was added for Vite 8 and is inert on 7 — the React samples still transform through esbuild, verified in the rebuilt bundles.

Test: vite build and vite dev both pass under Node 20.12.1; the sandbox now only prints the version warning.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@gaelsimon
gaelsimon merged commit ad26a56 into master Sep 4, 2026
12 checks passed
@gaelsimon
gaelsimon deleted the fix/vite-config-esm branch September 4, 2026 08:54
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.

1 participant