chore: enable React Compiler in Vitest for all plugins - #1852
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
🦋 Changeset detectedLatest commit: 2036db1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
✅ E2E Tests🟢 26 passed • view full report • view run Studio: https://plugins-e2e-test-studio-cyybovm78.sanity.dev Datasets: |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Pull request overview
Enforces React Compiler parity between tsdown.config.ts and vitest.config.ts across the plugins monorepo, so unit tests run against the same compiled output as published builds.
Changes:
- Update plugin generators (Vitest + package templates) to always wire
@rolldown/plugin-babel+reactCompilerPreset, mirroringreactCompiler: trueintsdown.config.ts. - Add a new
scripts/react-compiler-parityVitest project that fails CI/tests if compiler parity drifts. - Backfill existing plugins’
vitest.config.tsandpackage.jsondevDependencies, and document the invariant in agent/skill docs.
Reviewed changes
Copilot reviewed 106 out of 107 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| turbo/generators/templates/vitest.config.ts.hbs | Generator now emits RC-aware Vitest config (Babel + preset) and composes with vanilla-extract when present. |
| turbo/generators/templates/package.json.hbs | Generator now includes @rolldown/plugin-babel + @vitejs/plugin-react as devDependencies (catalog). |
| turbo/generators/templates/README.todo.md.hbs | Generator README guidance calls out keeping tsdown/vitest RC wiring in sync. |
| scripts/react-compiler-parity/package.json | New workspace test package for enforcing RC parity. |
| scripts/react-compiler-parity/vitest.config.ts | Vitest config for parity project (node environment). |
| scripts/react-compiler-parity/react-compiler-parity.test.ts | Parity test that scans plugins and asserts Vitest RC wiring when tsdown enables RC. |
| pnpm-workspace.yaml | Adds @rolldown/plugin-babel and @vitejs/plugin-react to the default catalog. |
| pnpm-lock.yaml | Locks new catalog deps and updates workspace dependency graph (also includes a sanity@next resolution bump). |
| AGENTS.md | Documents the “React Compiler Vitest parity” invariant and references enforcement script. |
| .agents/skills/sanity-plugin-best-practices/references/styling.md | Updates vanilla-extract Vitest examples to preserve RC Babel plugin composition. |
| .agents/skills/plugin-transfer/SKILL.md | Transfer guidance now calls out keeping RC parity in Vitest/tsdown. |
| .agents/skills/plugin-test-coverage/SKILL.md | Testing guidance now includes RC parity requirement and enforcement. |
| .agents/skills/migrate-styled-components-to-vanilla-extract/SKILL.md | Migration checklist updated to keep RC Babel plugin while adding vanilla-extract plugin. |
| plugins/@sanity/assist/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/assist/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/block-insert-picker/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/block-insert-picker/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/code-input/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/code-input/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/color-input/vitest.config.ts | Enables RC Babel stack in Vitest and composes with vanilla-extract plugin. |
| plugins/@sanity/color-input/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/cross-dataset-duplicator/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/cross-dataset-duplicator/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/dashboard/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/dashboard/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/debug-live-sync-tags/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/debug-live-sync-tags/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/document-internationalization/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/document-internationalization/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/embeddings-index-ui/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/embeddings-index-ui/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/form-toolkit/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/form-toolkit/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/google-maps-input/vitest.config.ts | Enables RC Babel stack in Vitest and composes with vanilla-extract plugin. |
| plugins/@sanity/google-maps-input/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/hierarchical-document-list/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/hierarchical-document-list/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/language-filter/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/language-filter/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/orderable-document-list/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/orderable-document-list/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/personalization-plugin/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/personalization-plugin/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/presets/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/presets/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/rich-date-input/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/rich-date-input/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/sanity-plugin-async-list/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/sanity-plugin-async-list/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/sfcc/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/sfcc/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/studio-secrets/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/studio-secrets/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/table/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/table/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/@sanity/vercel-protection-bypass/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/@sanity/vercel-protection-bypass/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-naive-html-serializer/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-naive-html-serializer/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-aprimo/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-aprimo/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-asset-source-unsplash/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-asset-source-unsplash/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-bynder-input/vitest.config.ts | Enables RC Babel stack in Vitest and composes with vanilla-extract plugin. |
| plugins/sanity-plugin-bynder-input/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-cloudinary/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-cloudinary/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-dashboard-widget-document-list/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-dashboard-widget-document-list/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-dashboard-widget-netlify/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-dashboard-widget-netlify/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-dashboard-widget-vercel/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-dashboard-widget-vercel/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-documents-pane/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-documents-pane/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-graph-view/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-graph-view/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-google-translate/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-google-translate/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-hotspot-array/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-hotspot-array/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-iframe-pane/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-iframe-pane/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-internationalized-array/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-internationalized-array/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-latex-input/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-latex-input/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-markdown/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-markdown/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-media/vitest.config.ts | Ensures Vitest runs with RC Babel stack for this plugin. |
| plugins/sanity-plugin-media/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-mux-input/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-mux-input/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-studio-smartling/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-studio-smartling/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-transifex/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-transifex/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-utils/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-utils/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-workflow/vitest.config.ts | Enables RC Babel stack in Vitest and composes with vanilla-extract plugin. |
| plugins/sanity-plugin-workflow/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-workspace-home/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-workspace-home/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-plugin-shopify-assets/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-plugin-shopify-assets/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
| plugins/sanity-translations-tab/vitest.config.ts | Enables RC Babel stack in Vitest for this plugin. |
| plugins/sanity-translations-tab/package.json | Adds @rolldown/plugin-babel + @vitejs/plugin-react devDependencies (catalog). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 106 out of 107 changed files in this pull request and generated no new comments.
Suppressed comments (2)
scripts/react-compiler-parity/react-compiler-parity.test.ts:66
- The detection logic is very permissive and can produce false passes/fails (eg,
reactCompiler:mentioned in a comment, orreactCompilerPresetimported but not actually wired). Since this test is enforcing a hard invariant, it should verify the concrete patterns you expect:reactCompiler: true/reactCompiler: {…}in tsdown, and apluginBabel({presets: [reactCompilerPreset()]})call in vitest config.
scripts/react-compiler-parity/react-compiler-parity.test.ts:18 - This parity test may be flaky on slower CI machines: it recursively walks the entire plugins/ tree and reads many files, but it uses the default Vitest timeout. Consider adding an explicit timeout (matching the repo’s 30_000ms convention) to avoid intermittent failures.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Compiler skipped in Vitest tests
- Confirmed the preset's client-only applyToEnvironmentHook made @rolldown/plugin-babel drop it in Vitest's SSR environment; fixed by overriding the hook to always apply in every plugin vitest.config.ts and the generator template, and strengthened the parity check to require the override.
Or push these changes by commenting:
@cursor push 1761f57462
Preview (1761f57462)
diff --git a/.agents/skills/migrate-styled-components-to-vanilla-extract/SKILL.md b/.agents/skills/migrate-styled-components-to-vanilla-extract/SKILL.md
--- a/.agents/skills/migrate-styled-components-to-vanilla-extract/SKILL.md
+++ b/.agents/skills/migrate-styled-components-to-vanilla-extract/SKILL.md
@@ -213,10 +213,16 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Keep React Compiler (matches `reactCompiler: true` in tsdown.config.ts) and
// compose vanilla-extract — do not replace the babel plugin.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]}), vanillaExtractPlugin()],
+ plugins: [pluginBabel({presets: [reactCompiler]}), vanillaExtractPlugin()],
// ...existing test config
})@@ -286,7 +292,7 @@
-
tsdown.config.ts:styledComponentsremoved,vanillaExtract: trueadded -
package.json: vanilla-extract devDeps added;styled-componentspeer removed;sanity/
@sanity/uipeer variants verified aligned inpnpm-lock.yaml
-- [ ]vitest.config.tsregistersvanillaExtractPlugin()alongside the existing React Compiler babel plugin (pluginBabel({presets: [reactCompilerPreset()]})) — do not drop compiler parity
+- [ ]vitest.config.tsregistersvanillaExtractPlugin()alongside the existing React Compiler babel plugin (pluginBabelwith theapplyToEnvironmentHook-overriddenreactCompilerPreset()) — do not drop compiler parity -
dist/bundle.cssemitted with all rules; package-exports snapshot updated -
pnpm format/pnpm lint/pnpm knip/pnpm build/pnpm test runall pass - Visual fidelity verified against the pre-migration rendering
diff --git a/.agents/skills/plugin-test-coverage/SKILL.md b/.agents/skills/plugin-test-coverage/SKILL.md
--- a/.agents/skills/plugin-test-coverage/SKILL.md
+++ b/.agents/skills/plugin-test-coverage/SKILL.md
@@ -41,7 +41,7 @@
- Context/provider tests: mock
useClient/useWorkspace/ pane hooks; useSuspense+actfor asyncReact.uselanguage resolution; call any module-levelclear()between tests. - Timeouts:
test('name', {timeout: 30_000}, async () => { … })— options object as second arg. - Keep the package-exports snapshot test; update with
pnpm test -uonly when exports intentionally change.
-- React Compiler is on in both build and Vitest — do not add unnecessaryuseMemo/useCallback. Iftsdown.config.tshasreactCompiler: true,vitest.config.tsmust registerpluginBabel({presets: [reactCompilerPreset()]})(same stack as@sanity/tsdown-config). Generators wire both; compose with other Vitest plugins rather than replacing them. Enforced byscripts/react-compiler-parity.
+- React Compiler is on in both build and Vitest — do not add unnecessaryuseMemo/useCallback. Iftsdown.config.tshasreactCompiler: true,vitest.config.tsmust registerpluginBabelwithreactCompilerPreset()and override the preset'sapplyToEnvironmentHookto always apply (Vitest transforms run in the SSR environment, which the default client-only hook excludes) — same stack as@sanity/tsdown-config. Generators wire both; compose with other Vitest plugins rather than replacing them. Enforced byscripts/react-compiler-parity.
Run a single package:
diff --git a/.agents/skills/sanity-plugin-best-practices/references/styling.md b/.agents/skills/sanity-plugin-best-practices/references/styling.md
--- a/.agents/skills/sanity-plugin-best-practices/references/styling.md
+++ b/.agents/skills/sanity-plugin-best-practices/references/styling.md
@@ -209,9 +209,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms run in the SSR environment; override the preset's
+// client-only applyToEnvironmentHook so the compiler is not skipped.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Keep React Compiler (matches tsdown reactCompiler: true) and compose VE.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]}), vanillaExtractPlugin()],
- plugins: [pluginBabel({presets: [reactCompiler]}), vanillaExtractPlugin()],
// ...
})
@@ -242,8 +247,11 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- plugins: [pluginBabel({presets: [reactCompilerPreset()]}), vanillaExtractPlugin()],
+ plugins: [pluginBabel({presets: [reactCompiler]}), vanillaExtractPlugin()],
test: {
setupFiles: ['@vanilla-extract/css/disableRuntimeStyles'],
// ...
diff --git a/AGENTS.md b/AGENTS.md
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -295,8 +295,14 @@
import pluginBabel from '@rolldown/plugin-babel'
import {reactCompilerPreset} from '@vitejs/plugin-react'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [reactCompiler]})],
// ...
})
diff --git a/plugins/@sanity/assist/vitest.config.ts b/plugins/@sanity/assist/vitest.config.ts
--- a/plugins/@sanity/assist/vitest.config.ts
+++ b/plugins/@sanity/assist/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/@sanity/block-insert-picker/vitest.config.ts b/plugins/@sanity/block-insert-picker/vitest.config.ts
--- a/plugins/@sanity/block-insert-picker/vitest.config.ts
+++ b/plugins/@sanity/block-insert-picker/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
environment: 'jsdom',
server: {
diff --git a/plugins/@sanity/code-input/vitest.config.ts b/plugins/@sanity/code-input/vitest.config.ts
--- a/plugins/@sanity/code-input/vitest.config.ts
+++ b/plugins/@sanity/code-input/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/@sanity/color-input/vitest.config.ts b/plugins/@sanity/color-input/vitest.config.ts
--- a/plugins/@sanity/color-input/vitest.config.ts
+++ b/plugins/@sanity/color-input/vitest.config.ts
@@ -3,9 +3,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]}), vanillaExtractPlugin()],
- plugins: [pluginBabel({presets: [reactCompiler]}), vanillaExtractPlugin()],
test: {
setupFiles: ['@vanilla-extract/css/disableRuntimeStyles'],
server: {
diff --git a/plugins/@sanity/cross-dataset-duplicator/vitest.config.ts b/plugins/@sanity/cross-dataset-duplicator/vitest.config.ts
--- a/plugins/@sanity/cross-dataset-duplicator/vitest.config.ts
+++ b/plugins/@sanity/cross-dataset-duplicator/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/@sanity/dashboard/vitest.config.ts b/plugins/@sanity/dashboard/vitest.config.ts
--- a/plugins/@sanity/dashboard/vitest.config.ts
+++ b/plugins/@sanity/dashboard/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/@sanity/debug-live-sync-tags/vitest.config.ts b/plugins/@sanity/debug-live-sync-tags/vitest.config.ts
--- a/plugins/@sanity/debug-live-sync-tags/vitest.config.ts
+++ b/plugins/@sanity/debug-live-sync-tags/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/@sanity/document-internationalization/vitest.config.ts b/plugins/@sanity/document-internationalization/vitest.config.ts
--- a/plugins/@sanity/document-internationalization/vitest.config.ts
+++ b/plugins/@sanity/document-internationalization/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
environment: 'jsdom',
setupFiles: ['./src/test/setup.ts'],
diff --git a/plugins/@sanity/embeddings-index-ui/vitest.config.ts b/plugins/@sanity/embeddings-index-ui/vitest.config.ts
--- a/plugins/@sanity/embeddings-index-ui/vitest.config.ts
+++ b/plugins/@sanity/embeddings-index-ui/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/@sanity/form-toolkit/vitest.config.ts b/plugins/@sanity/form-toolkit/vitest.config.ts
--- a/plugins/@sanity/form-toolkit/vitest.config.ts
+++ b/plugins/@sanity/form-toolkit/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
// Component tests opt into jsdom per-file via// @vitest-environment jsdom.
// The default staysnodeso the package-exports test keeps resolvingsanity
diff --git a/plugins/@sanity/google-maps-input/vitest.config.ts b/plugins/@sanity/google-maps-input/vitest.config.ts
--- a/plugins/@sanity/google-maps-input/vitest.config.ts
+++ b/plugins/@sanity/google-maps-input/vitest.config.ts
@@ -3,9 +3,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]}), vanillaExtractPlugin()],
- plugins: [pluginBabel({presets: [reactCompiler]}), vanillaExtractPlugin()],
test: {
setupFiles: ['@vanilla-extract/css/disableRuntimeStyles'],
server: {
diff --git a/plugins/@sanity/hierarchical-document-list/vitest.config.ts b/plugins/@sanity/hierarchical-document-list/vitest.config.ts
--- a/plugins/@sanity/hierarchical-document-list/vitest.config.ts
+++ b/plugins/@sanity/hierarchical-document-list/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/@sanity/language-filter/vitest.config.ts b/plugins/@sanity/language-filter/vitest.config.ts
--- a/plugins/@sanity/language-filter/vitest.config.ts
+++ b/plugins/@sanity/language-filter/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
environment: 'jsdom',
setupFiles: ['./src/test/setup.ts'],
diff --git a/plugins/@sanity/orderable-document-list/vitest.config.ts b/plugins/@sanity/orderable-document-list/vitest.config.ts
--- a/plugins/@sanity/orderable-document-list/vitest.config.ts
+++ b/plugins/@sanity/orderable-document-list/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/@sanity/personalization-plugin/vitest.config.ts b/plugins/@sanity/personalization-plugin/vitest.config.ts
--- a/plugins/@sanity/personalization-plugin/vitest.config.ts
+++ b/plugins/@sanity/personalization-plugin/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/@sanity/presets/vitest.config.ts b/plugins/@sanity/presets/vitest.config.ts
--- a/plugins/@sanity/presets/vitest.config.ts
+++ b/plugins/@sanity/presets/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
environment: 'jsdom',
setupFiles: ['./src/test/setup.ts'],
diff --git a/plugins/@sanity/rich-date-input/vitest.config.ts b/plugins/@sanity/rich-date-input/vitest.config.ts
--- a/plugins/@sanity/rich-date-input/vitest.config.ts
+++ b/plugins/@sanity/rich-date-input/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/@sanity/sanity-plugin-async-list/vitest.config.ts b/plugins/@sanity/sanity-plugin-async-list/vitest.config.ts
--- a/plugins/@sanity/sanity-plugin-async-list/vitest.config.ts
+++ b/plugins/@sanity/sanity-plugin-async-list/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/@sanity/sfcc/vitest.config.ts b/plugins/@sanity/sfcc/vitest.config.ts
--- a/plugins/@sanity/sfcc/vitest.config.ts
+++ b/plugins/@sanity/sfcc/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/@sanity/studio-secrets/vitest.config.ts b/plugins/@sanity/studio-secrets/vitest.config.ts
--- a/plugins/@sanity/studio-secrets/vitest.config.ts
+++ b/plugins/@sanity/studio-secrets/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
environment: 'jsdom',
setupFiles: ['./src/test/setup.ts'],
diff --git a/plugins/@sanity/table/vitest.config.ts b/plugins/@sanity/table/vitest.config.ts
--- a/plugins/@sanity/table/vitest.config.ts
+++ b/plugins/@sanity/table/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/@sanity/vercel-protection-bypass/vitest.config.ts b/plugins/@sanity/vercel-protection-bypass/vitest.config.ts
--- a/plugins/@sanity/vercel-protection-bypass/vitest.config.ts
+++ b/plugins/@sanity/vercel-protection-bypass/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/sanity-naive-html-serializer/vitest.config.ts b/plugins/sanity-naive-html-serializer/vitest.config.ts
--- a/plugins/sanity-naive-html-serializer/vitest.config.ts
+++ b/plugins/sanity-naive-html-serializer/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
environment: 'jsdom',
setupFiles: ['./test/global.setup.ts'],
diff --git a/plugins/sanity-plugin-aprimo/vitest.config.ts b/plugins/sanity-plugin-aprimo/vitest.config.ts
--- a/plugins/sanity-plugin-aprimo/vitest.config.ts
+++ b/plugins/sanity-plugin-aprimo/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/sanity-plugin-asset-source-unsplash/vitest.config.ts b/plugins/sanity-plugin-asset-source-unsplash/vitest.config.ts
--- a/plugins/sanity-plugin-asset-source-unsplash/vitest.config.ts
+++ b/plugins/sanity-plugin-asset-source-unsplash/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/sanity-plugin-bynder-input/vitest.config.ts b/plugins/sanity-plugin-bynder-input/vitest.config.ts
--- a/plugins/sanity-plugin-bynder-input/vitest.config.ts
+++ b/plugins/sanity-plugin-bynder-input/vitest.config.ts
@@ -3,9 +3,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]}), vanillaExtractPlugin()],
- plugins: [pluginBabel({presets: [reactCompiler]}), vanillaExtractPlugin()],
test: {
setupFiles: ['@vanilla-extract/css/disableRuntimeStyles'],
server: {
diff --git a/plugins/sanity-plugin-cloudinary/vitest.config.ts b/plugins/sanity-plugin-cloudinary/vitest.config.ts
--- a/plugins/sanity-plugin-cloudinary/vitest.config.ts
+++ b/plugins/sanity-plugin-cloudinary/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/sanity-plugin-dashboard-widget-document-list/vitest.config.ts b/plugins/sanity-plugin-dashboard-widget-document-list/vitest.config.ts
--- a/plugins/sanity-plugin-dashboard-widget-document-list/vitest.config.ts
+++ b/plugins/sanity-plugin-dashboard-widget-document-list/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/sanity-plugin-dashboard-widget-netlify/vitest.config.ts b/plugins/sanity-plugin-dashboard-widget-netlify/vitest.config.ts
--- a/plugins/sanity-plugin-dashboard-widget-netlify/vitest.config.ts
+++ b/plugins/sanity-plugin-dashboard-widget-netlify/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/sanity-plugin-dashboard-widget-vercel/vitest.config.ts b/plugins/sanity-plugin-dashboard-widget-vercel/vitest.config.ts
--- a/plugins/sanity-plugin-dashboard-widget-vercel/vitest.config.ts
+++ b/plugins/sanity-plugin-dashboard-widget-vercel/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/sanity-plugin-documents-pane/vitest.config.ts b/plugins/sanity-plugin-documents-pane/vitest.config.ts
--- a/plugins/sanity-plugin-documents-pane/vitest.config.ts
+++ b/plugins/sanity-plugin-documents-pane/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/sanity-plugin-google-translate/vitest.config.ts b/plugins/sanity-plugin-google-translate/vitest.config.ts
--- a/plugins/sanity-plugin-google-translate/vitest.config.ts
+++ b/plugins/sanity-plugin-google-translate/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/sanity-plugin-graph-view/vitest.config.ts b/plugins/sanity-plugin-graph-view/vitest.config.ts
--- a/plugins/sanity-plugin-graph-view/vitest.config.ts
+++ b/plugins/sanity-plugin-graph-view/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
+const reactCompiler = reactCompilerPreset()
+reactCompiler.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
// Match reactCompiler: true in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
- plugins: [pluginBabel({presets: [reactCompiler]})],
test: {
server: {
deps: {
diff --git a/plugins/sanity-plugin-hotspot-array/vitest.config.ts b/plugins/sanity-plugin-hotspot-array/vitest.config.ts
--- a/plugins/sanity-plugin-hotspot-array/vitest.config.ts
+++ b/plugins/sanity-plugin-hotspot-array/vitest.config.ts
@@ -2,9 +2,15 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Vitest transforms modules through the SSR environment ('server' consumer), which
+// reactCompilerPreset()'s default applyToEnvironmentHook excludes. Apply it
+// unconditionally so tests exercise compiled output, like published tsdown builds.
... diff truncated: showing 800 of 1144 lines
</details>
<sub>You can send follow-ups to the cloud agent <a href="https://cursor.com/agents/bc-b85de904-482c-4f87-b891-d955dfa76905">here</a>.</sub>
</details>
|
Bugbot Autofix prepared a fix for the issue found in the latest run.
Or push these changes by commenting: Preview (2983be7d99)diff --git a/AGENTS.md b/AGENTS.md
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -295,8 +295,14 @@
import pluginBabel from '@rolldown/plugin-babel'
import {reactCompilerPreset} from '@vitejs/plugin-react'
+// reactCompilerPreset only applies to Vite environments with `consumer === 'client'`, but
+// Vitest transforms node-environment tests through the `ssr` environment — lift the gate
+// so those tests do not silently run uncompiled `src`.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {jsx: {runtime: 'automatic'}},
// ...
})
diff --git a/plugins/@sanity/assist/vitest.config.ts b/plugins/@sanity/assist/vitest.config.ts
--- a/plugins/@sanity/assist/vitest.config.ts
+++ b/plugins/@sanity/assist/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/block-insert-picker/vitest.config.ts b/plugins/@sanity/block-insert-picker/vitest.config.ts
--- a/plugins/@sanity/block-insert-picker/vitest.config.ts
+++ b/plugins/@sanity/block-insert-picker/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/code-input/vitest.config.ts b/plugins/@sanity/code-input/vitest.config.ts
--- a/plugins/@sanity/code-input/vitest.config.ts
+++ b/plugins/@sanity/code-input/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/color-input/vitest.config.ts b/plugins/@sanity/color-input/vitest.config.ts
--- a/plugins/@sanity/color-input/vitest.config.ts
+++ b/plugins/@sanity/color-input/vitest.config.ts
@@ -3,9 +3,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]}), vanillaExtractPlugin()],
+ plugins: [pluginBabel({presets: [compilerPreset]}), vanillaExtractPlugin()],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/cross-dataset-duplicator/vitest.config.ts b/plugins/@sanity/cross-dataset-duplicator/vitest.config.ts
--- a/plugins/@sanity/cross-dataset-duplicator/vitest.config.ts
+++ b/plugins/@sanity/cross-dataset-duplicator/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/dashboard/vitest.config.ts b/plugins/@sanity/dashboard/vitest.config.ts
--- a/plugins/@sanity/dashboard/vitest.config.ts
+++ b/plugins/@sanity/dashboard/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/debug-live-sync-tags/vitest.config.ts b/plugins/@sanity/debug-live-sync-tags/vitest.config.ts
--- a/plugins/@sanity/debug-live-sync-tags/vitest.config.ts
+++ b/plugins/@sanity/debug-live-sync-tags/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/document-internationalization/vitest.config.ts b/plugins/@sanity/document-internationalization/vitest.config.ts
--- a/plugins/@sanity/document-internationalization/vitest.config.ts
+++ b/plugins/@sanity/document-internationalization/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/embeddings-index-ui/vitest.config.ts b/plugins/@sanity/embeddings-index-ui/vitest.config.ts
--- a/plugins/@sanity/embeddings-index-ui/vitest.config.ts
+++ b/plugins/@sanity/embeddings-index-ui/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/form-toolkit/vitest.config.ts b/plugins/@sanity/form-toolkit/vitest.config.ts
--- a/plugins/@sanity/form-toolkit/vitest.config.ts
+++ b/plugins/@sanity/form-toolkit/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/google-maps-input/vitest.config.ts b/plugins/@sanity/google-maps-input/vitest.config.ts
--- a/plugins/@sanity/google-maps-input/vitest.config.ts
+++ b/plugins/@sanity/google-maps-input/vitest.config.ts
@@ -3,9 +3,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]}), vanillaExtractPlugin()],
+ plugins: [pluginBabel({presets: [compilerPreset]}), vanillaExtractPlugin()],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/hierarchical-document-list/vitest.config.ts b/plugins/@sanity/hierarchical-document-list/vitest.config.ts
--- a/plugins/@sanity/hierarchical-document-list/vitest.config.ts
+++ b/plugins/@sanity/hierarchical-document-list/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/language-filter/vitest.config.ts b/plugins/@sanity/language-filter/vitest.config.ts
--- a/plugins/@sanity/language-filter/vitest.config.ts
+++ b/plugins/@sanity/language-filter/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/orderable-document-list/vitest.config.ts b/plugins/@sanity/orderable-document-list/vitest.config.ts
--- a/plugins/@sanity/orderable-document-list/vitest.config.ts
+++ b/plugins/@sanity/orderable-document-list/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/personalization-plugin/vitest.config.ts b/plugins/@sanity/personalization-plugin/vitest.config.ts
--- a/plugins/@sanity/personalization-plugin/vitest.config.ts
+++ b/plugins/@sanity/personalization-plugin/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/presets/vitest.config.ts b/plugins/@sanity/presets/vitest.config.ts
--- a/plugins/@sanity/presets/vitest.config.ts
+++ b/plugins/@sanity/presets/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/rich-date-input/vitest.config.ts b/plugins/@sanity/rich-date-input/vitest.config.ts
--- a/plugins/@sanity/rich-date-input/vitest.config.ts
+++ b/plugins/@sanity/rich-date-input/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/sanity-plugin-async-list/vitest.config.ts b/plugins/@sanity/sanity-plugin-async-list/vitest.config.ts
--- a/plugins/@sanity/sanity-plugin-async-list/vitest.config.ts
+++ b/plugins/@sanity/sanity-plugin-async-list/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/sfcc/vitest.config.ts b/plugins/@sanity/sfcc/vitest.config.ts
--- a/plugins/@sanity/sfcc/vitest.config.ts
+++ b/plugins/@sanity/sfcc/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/studio-secrets/vitest.config.ts b/plugins/@sanity/studio-secrets/vitest.config.ts
--- a/plugins/@sanity/studio-secrets/vitest.config.ts
+++ b/plugins/@sanity/studio-secrets/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/table/vitest.config.ts b/plugins/@sanity/table/vitest.config.ts
--- a/plugins/@sanity/table/vitest.config.ts
+++ b/plugins/@sanity/table/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/@sanity/vercel-protection-bypass/vitest.config.ts b/plugins/@sanity/vercel-protection-bypass/vitest.config.ts
--- a/plugins/@sanity/vercel-protection-bypass/vitest.config.ts
+++ b/plugins/@sanity/vercel-protection-bypass/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/sanity-naive-html-serializer/vitest.config.ts b/plugins/sanity-naive-html-serializer/vitest.config.ts
--- a/plugins/sanity-naive-html-serializer/vitest.config.ts
+++ b/plugins/sanity-naive-html-serializer/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/sanity-plugin-aprimo/vitest.config.ts b/plugins/sanity-plugin-aprimo/vitest.config.ts
--- a/plugins/sanity-plugin-aprimo/vitest.config.ts
+++ b/plugins/sanity-plugin-aprimo/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/sanity-plugin-asset-source-unsplash/vitest.config.ts b/plugins/sanity-plugin-asset-source-unsplash/vitest.config.ts
--- a/plugins/sanity-plugin-asset-source-unsplash/vitest.config.ts
+++ b/plugins/sanity-plugin-asset-source-unsplash/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/sanity-plugin-bynder-input/vitest.config.ts b/plugins/sanity-plugin-bynder-input/vitest.config.ts
--- a/plugins/sanity-plugin-bynder-input/vitest.config.ts
+++ b/plugins/sanity-plugin-bynder-input/vitest.config.ts
@@ -3,9 +3,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]}), vanillaExtractPlugin()],
+ plugins: [pluginBabel({presets: [compilerPreset]}), vanillaExtractPlugin()],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/sanity-plugin-cloudinary/vitest.config.ts b/plugins/sanity-plugin-cloudinary/vitest.config.ts
--- a/plugins/sanity-plugin-cloudinary/vitest.config.ts
+++ b/plugins/sanity-plugin-cloudinary/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/sanity-plugin-dashboard-widget-document-list/vitest.config.ts b/plugins/sanity-plugin-dashboard-widget-document-list/vitest.config.ts
--- a/plugins/sanity-plugin-dashboard-widget-document-list/vitest.config.ts
+++ b/plugins/sanity-plugin-dashboard-widget-document-list/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/sanity-plugin-dashboard-widget-netlify/vitest.config.ts b/plugins/sanity-plugin-dashboard-widget-netlify/vitest.config.ts
--- a/plugins/sanity-plugin-dashboard-widget-netlify/vitest.config.ts
+++ b/plugins/sanity-plugin-dashboard-widget-netlify/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/sanity-plugin-dashboard-widget-vercel/vitest.config.ts b/plugins/sanity-plugin-dashboard-widget-vercel/vitest.config.ts
--- a/plugins/sanity-plugin-dashboard-widget-vercel/vitest.config.ts
+++ b/plugins/sanity-plugin-dashboard-widget-vercel/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/sanity-plugin-documents-pane/vitest.config.ts b/plugins/sanity-plugin-documents-pane/vitest.config.ts
--- a/plugins/sanity-plugin-documents-pane/vitest.config.ts
+++ b/plugins/sanity-plugin-documents-pane/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/sanity-plugin-google-translate/vitest.config.ts b/plugins/sanity-plugin-google-translate/vitest.config.ts
--- a/plugins/sanity-plugin-google-translate/vitest.config.ts
+++ b/plugins/sanity-plugin-google-translate/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/sanity-plugin-graph-view/vitest.config.ts b/plugins/sanity-plugin-graph-view/vitest.config.ts
--- a/plugins/sanity-plugin-graph-view/vitest.config.ts
+++ b/plugins/sanity-plugin-graph-view/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/sanity-plugin-hotspot-array/vitest.config.ts b/plugins/sanity-plugin-hotspot-array/vitest.config.ts
--- a/plugins/sanity-plugin-hotspot-array/vitest.config.ts
+++ b/plugins/sanity-plugin-hotspot-array/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/sanity-plugin-iframe-pane/vitest.config.ts b/plugins/sanity-plugin-iframe-pane/vitest.config.ts
--- a/plugins/sanity-plugin-iframe-pane/vitest.config.ts
+++ b/plugins/sanity-plugin-iframe-pane/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/sanity-plugin-internationalized-array/vitest.config.ts b/plugins/sanity-plugin-internationalized-array/vitest.config.ts
--- a/plugins/sanity-plugin-internationalized-array/vitest.config.ts
+++ b/plugins/sanity-plugin-internationalized-array/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/sanity-plugin-latex-input/vitest.config.ts b/plugins/sanity-plugin-latex-input/vitest.config.ts
--- a/plugins/sanity-plugin-latex-input/vitest.config.ts
+++ b/plugins/sanity-plugin-latex-input/vitest.config.ts
@@ -2,9 +2,14 @@
import {reactCompilerPreset} from '@vitejs/plugin-react'
import {defineConfig} from 'vitest/config'
+// Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
+// Vitest transforms node-environment tests through the `ssr` Vite environment, where the
+// preset's client-only default would silently drop the compiler — apply it everywhere.
+const compilerPreset = reactCompilerPreset()
+compilerPreset.rolldown.applyToEnvironmentHook = () => true
+
export default defineConfig({
- // Match `reactCompiler: true` in tsdown.config.ts so tests exercise compiled output.
- plugins: [pluginBabel({presets: [reactCompilerPreset()]})],
+ plugins: [pluginBabel({presets: [compilerPreset]})],
oxc: {
jsx: {runtime: 'automatic'},
},
diff --git a/plugins/sanity-plugin-markdown/vitest.config.ts b/plugins/sanity-plugin-markdown/vitest.config.ts
--- a/plugins/sanity-plugin-markdown/vitest.config.ts
+++ b/plugins/sanity-plugin-markdown/vitest.config.ts
... diff truncated: showing 800 of 1063 linesYou can send follow-ups to the cloud agent here. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 107 out of 108 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
scripts/react-compiler-parity/react-compiler-parity.test.ts:30
- This test walks the entire
plugins/tree and reads many files, but it uses Vitest's default timeout (typically 5s). That can be flaky on slower CI machines; the other tests in this file already set{timeout: 30_000}.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 107 out of 108 changed files in this pull request and generated no new comments.
Suppressed comments (2)
scripts/react-compiler-parity/react-compiler-parity.test.ts:90
import(path.join(...))uses an absolute path string as a module specifier; this is not reliably cross-platform (notably on Windows). Convert the path to afile://URL viapathToFileURL(...).hrefbefore importing.
scripts/react-compiler-parity/react-compiler-parity.test.ts:4- Dynamic import later in this test should use a file URL. Importing an absolute filesystem path string works on POSIX, but is unreliable on Windows (backslashes / drive letters) and can break
import()resolution. AddpathToFileURLso the specifier is portable.
This issue also appears on line 87 of the same file.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Skip misses JSX-only React modules
- Changed the skip in every copy of reactCompilerPluginForVitest (all plugin vitest configs, the generator template, the parity test, and docs) so .tsx/.jsx files always run oxc-transform-react while non-JSX modules without a react import still skip, and added a JSX-only parity test fixture that fails against the old regex.
Or push these changes by commenting:
@cursor push 5e98bbcc30
Preview (5e98bbcc30)
diff --git a/.agents/skills/sanity-plugin-best-practices/references/styling.md b/.agents/skills/sanity-plugin-best-practices/references/styling.md
--- a/.agents/skills/sanity-plugin-best-practices/references/styling.md
+++ b/.agents/skills/sanity-plugin-best-practices/references/styling.md
@@ -216,9 +216,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
@@ -278,9 +279,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/AGENTS.md b/AGENTS.md
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -307,9 +307,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/assist/vitest.config.ts b/plugins/@sanity/assist/vitest.config.ts
--- a/plugins/@sanity/assist/vitest.config.ts
+++ b/plugins/@sanity/assist/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/block-insert-picker/vitest.config.ts b/plugins/@sanity/block-insert-picker/vitest.config.ts
--- a/plugins/@sanity/block-insert-picker/vitest.config.ts
+++ b/plugins/@sanity/block-insert-picker/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/code-input/vitest.config.ts b/plugins/@sanity/code-input/vitest.config.ts
--- a/plugins/@sanity/code-input/vitest.config.ts
+++ b/plugins/@sanity/code-input/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/color-input/vitest.config.ts b/plugins/@sanity/color-input/vitest.config.ts
--- a/plugins/@sanity/color-input/vitest.config.ts
+++ b/plugins/@sanity/color-input/vitest.config.ts
@@ -11,9 +11,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/cross-dataset-duplicator/vitest.config.ts b/plugins/@sanity/cross-dataset-duplicator/vitest.config.ts
--- a/plugins/@sanity/cross-dataset-duplicator/vitest.config.ts
+++ b/plugins/@sanity/cross-dataset-duplicator/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/dashboard/vitest.config.ts b/plugins/@sanity/dashboard/vitest.config.ts
--- a/plugins/@sanity/dashboard/vitest.config.ts
+++ b/plugins/@sanity/dashboard/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/debug-live-sync-tags/vitest.config.ts b/plugins/@sanity/debug-live-sync-tags/vitest.config.ts
--- a/plugins/@sanity/debug-live-sync-tags/vitest.config.ts
+++ b/plugins/@sanity/debug-live-sync-tags/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/document-internationalization/vitest.config.ts b/plugins/@sanity/document-internationalization/vitest.config.ts
--- a/plugins/@sanity/document-internationalization/vitest.config.ts
+++ b/plugins/@sanity/document-internationalization/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/embeddings-index-ui/vitest.config.ts b/plugins/@sanity/embeddings-index-ui/vitest.config.ts
--- a/plugins/@sanity/embeddings-index-ui/vitest.config.ts
+++ b/plugins/@sanity/embeddings-index-ui/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/form-toolkit/vitest.config.ts b/plugins/@sanity/form-toolkit/vitest.config.ts
--- a/plugins/@sanity/form-toolkit/vitest.config.ts
+++ b/plugins/@sanity/form-toolkit/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/google-maps-input/vitest.config.ts b/plugins/@sanity/google-maps-input/vitest.config.ts
--- a/plugins/@sanity/google-maps-input/vitest.config.ts
+++ b/plugins/@sanity/google-maps-input/vitest.config.ts
@@ -11,9 +11,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/hierarchical-document-list/vitest.config.ts b/plugins/@sanity/hierarchical-document-list/vitest.config.ts
--- a/plugins/@sanity/hierarchical-document-list/vitest.config.ts
+++ b/plugins/@sanity/hierarchical-document-list/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/language-filter/vitest.config.ts b/plugins/@sanity/language-filter/vitest.config.ts
--- a/plugins/@sanity/language-filter/vitest.config.ts
+++ b/plugins/@sanity/language-filter/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/orderable-document-list/vitest.config.ts b/plugins/@sanity/orderable-document-list/vitest.config.ts
--- a/plugins/@sanity/orderable-document-list/vitest.config.ts
+++ b/plugins/@sanity/orderable-document-list/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/personalization-plugin/vitest.config.ts b/plugins/@sanity/personalization-plugin/vitest.config.ts
--- a/plugins/@sanity/personalization-plugin/vitest.config.ts
+++ b/plugins/@sanity/personalization-plugin/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/presets/vitest.config.ts b/plugins/@sanity/presets/vitest.config.ts
--- a/plugins/@sanity/presets/vitest.config.ts
+++ b/plugins/@sanity/presets/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/rich-date-input/vitest.config.ts b/plugins/@sanity/rich-date-input/vitest.config.ts
--- a/plugins/@sanity/rich-date-input/vitest.config.ts
+++ b/plugins/@sanity/rich-date-input/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/sanity-plugin-async-list/vitest.config.ts b/plugins/@sanity/sanity-plugin-async-list/vitest.config.ts
--- a/plugins/@sanity/sanity-plugin-async-list/vitest.config.ts
+++ b/plugins/@sanity/sanity-plugin-async-list/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/sfcc/vitest.config.ts b/plugins/@sanity/sfcc/vitest.config.ts
--- a/plugins/@sanity/sfcc/vitest.config.ts
+++ b/plugins/@sanity/sfcc/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/studio-secrets/vitest.config.ts b/plugins/@sanity/studio-secrets/vitest.config.ts
--- a/plugins/@sanity/studio-secrets/vitest.config.ts
+++ b/plugins/@sanity/studio-secrets/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/table/vitest.config.ts b/plugins/@sanity/table/vitest.config.ts
--- a/plugins/@sanity/table/vitest.config.ts
+++ b/plugins/@sanity/table/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/@sanity/vercel-protection-bypass/vitest.config.ts b/plugins/@sanity/vercel-protection-bypass/vitest.config.ts
--- a/plugins/@sanity/vercel-protection-bypass/vitest.config.ts
+++ b/plugins/@sanity/vercel-protection-bypass/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-naive-html-serializer/vitest.config.ts b/plugins/sanity-naive-html-serializer/vitest.config.ts
--- a/plugins/sanity-naive-html-serializer/vitest.config.ts
+++ b/plugins/sanity-naive-html-serializer/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-aprimo/vitest.config.ts b/plugins/sanity-plugin-aprimo/vitest.config.ts
--- a/plugins/sanity-plugin-aprimo/vitest.config.ts
+++ b/plugins/sanity-plugin-aprimo/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-asset-source-unsplash/vitest.config.ts b/plugins/sanity-plugin-asset-source-unsplash/vitest.config.ts
--- a/plugins/sanity-plugin-asset-source-unsplash/vitest.config.ts
+++ b/plugins/sanity-plugin-asset-source-unsplash/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-bynder-input/vitest.config.ts b/plugins/sanity-plugin-bynder-input/vitest.config.ts
--- a/plugins/sanity-plugin-bynder-input/vitest.config.ts
+++ b/plugins/sanity-plugin-bynder-input/vitest.config.ts
@@ -11,9 +11,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-cloudinary/vitest.config.ts b/plugins/sanity-plugin-cloudinary/vitest.config.ts
--- a/plugins/sanity-plugin-cloudinary/vitest.config.ts
+++ b/plugins/sanity-plugin-cloudinary/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-dashboard-widget-document-list/vitest.config.ts b/plugins/sanity-plugin-dashboard-widget-document-list/vitest.config.ts
--- a/plugins/sanity-plugin-dashboard-widget-document-list/vitest.config.ts
+++ b/plugins/sanity-plugin-dashboard-widget-document-list/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-dashboard-widget-netlify/vitest.config.ts b/plugins/sanity-plugin-dashboard-widget-netlify/vitest.config.ts
--- a/plugins/sanity-plugin-dashboard-widget-netlify/vitest.config.ts
+++ b/plugins/sanity-plugin-dashboard-widget-netlify/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-dashboard-widget-vercel/vitest.config.ts b/plugins/sanity-plugin-dashboard-widget-vercel/vitest.config.ts
--- a/plugins/sanity-plugin-dashboard-widget-vercel/vitest.config.ts
+++ b/plugins/sanity-plugin-dashboard-widget-vercel/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-documents-pane/vitest.config.ts b/plugins/sanity-plugin-documents-pane/vitest.config.ts
--- a/plugins/sanity-plugin-documents-pane/vitest.config.ts
+++ b/plugins/sanity-plugin-documents-pane/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-google-translate/vitest.config.ts b/plugins/sanity-plugin-google-translate/vitest.config.ts
--- a/plugins/sanity-plugin-google-translate/vitest.config.ts
+++ b/plugins/sanity-plugin-google-translate/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-graph-view/vitest.config.ts b/plugins/sanity-plugin-graph-view/vitest.config.ts
--- a/plugins/sanity-plugin-graph-view/vitest.config.ts
+++ b/plugins/sanity-plugin-graph-view/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-hotspot-array/vitest.config.ts b/plugins/sanity-plugin-hotspot-array/vitest.config.ts
--- a/plugins/sanity-plugin-hotspot-array/vitest.config.ts
+++ b/plugins/sanity-plugin-hotspot-array/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-iframe-pane/vitest.config.ts b/plugins/sanity-plugin-iframe-pane/vitest.config.ts
--- a/plugins/sanity-plugin-iframe-pane/vitest.config.ts
+++ b/plugins/sanity-plugin-iframe-pane/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-internationalized-array/vitest.config.ts b/plugins/sanity-plugin-internationalized-array/vitest.config.ts
--- a/plugins/sanity-plugin-internationalized-array/vitest.config.ts
+++ b/plugins/sanity-plugin-internationalized-array/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-latex-input/vitest.config.ts b/plugins/sanity-plugin-latex-input/vitest.config.ts
--- a/plugins/sanity-plugin-latex-input/vitest.config.ts
+++ b/plugins/sanity-plugin-latex-input/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-markdown/vitest.config.ts b/plugins/sanity-plugin-markdown/vitest.config.ts
--- a/plugins/sanity-plugin-markdown/vitest.config.ts
+++ b/plugins/sanity-plugin-markdown/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-media/vitest.config.ts b/plugins/sanity-plugin-media/vitest.config.ts
--- a/plugins/sanity-plugin-media/vitest.config.ts
+++ b/plugins/sanity-plugin-media/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-mux-input/vitest.config.ts b/plugins/sanity-plugin-mux-input/vitest.config.ts
--- a/plugins/sanity-plugin-mux-input/vitest.config.ts
+++ b/plugins/sanity-plugin-mux-input/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-shopify-assets/vitest.config.ts b/plugins/sanity-plugin-shopify-assets/vitest.config.ts
--- a/plugins/sanity-plugin-shopify-assets/vitest.config.ts
+++ b/plugins/sanity-plugin-shopify-assets/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
+ // `import * as _jestDom` side-effect imports in Vitest setup files.
+ if (!/\.[tj]sx$/.test(filename) && !/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
return null
}
const result = transformSync(filename, code, {
diff --git a/plugins/sanity-plugin-studio-smartling/vitest.config.ts b/plugins/sanity-plugin-studio-smartling/vitest.config.ts
--- a/plugins/sanity-plugin-studio-smartling/vitest.config.ts
+++ b/plugins/sanity-plugin-studio-smartling/vitest.config.ts
@@ -10,9 +10,10 @@
filter: {id: {include: /\.[tj]sx?(?:\?|$)/, exclude: /\/node_modules\//}},
handler(code: string, id: string) {
const filename = id.includes('?') ? id.slice(0, id.indexOf('?')) : id
- // Skip non-React modules. oxc DCE drops unused `import * as _jestDom`
- // side-effect imports in Vitest setup files.
- if (!/(?:from|import)\s*['"]react(?:['"]|\/)/.test(code)) {
+ // Skip non-React modules — but `.tsx`/`.jsx` files always are (the
+ // automatic JSX runtime needs no react import). oxc DCE drops unused
... diff truncated: showing 800 of 990 linesYou can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 249df77. Configure here.
Add @sanity/plugin-kit/vitest exporting reactCompilerPluginForVitest(), register it in every plugin vitest.config.ts so tests exercise the same oxc-compiled output that tsdown ships, wire it into the generators, and enforce the tsdown/Vitest pairing with scripts/react-compiler-parity.
8ecf29a to
2036db1
Compare


Summary
Makes React Compiler in Vitest a hard invariant with
tsdown.config.ts, so unit tests exercise the same compiled output as published builds (the gap that forced the late Vitest opt-in in #1841 forsanity-plugin-media).Changes
@sanity/plugin-kit/vitest— new export withreactCompilerPluginForVitest(), a Vite plugin that runs the oxc React Compiler transform over plugin sources in Vitest. The compiler should always run for plugin code, but@vitejs/plugin-react'scompiler: truenever applies in Vitest (it only compiles browser builds, not Vitest's transform pipeline), so the plugin callsoxc-transform-reactdirectly. It skips non-JSX modules without areactimport so oxc DCE cannot drop side-effect imports like@testing-library/jest-dom/vitestin setup files;.tsx/.jsxalways compile (automatic-runtime JSX needs no explicitreactimport).vitest.config.ts(a 3-line diff per plugin; skipped@sanity/debug-preview-url-secret-plugin, which has no RC). The package resolves through the root devDependency likevitest/vitest-package-exports— per-pluginworkspace:^devDeps would break thepnpm packstep of plugin builds.vitest.config.ts.hbsemits the same import, so new plugins get parity for free.scripts/react-compiler-parityfailspnpm testif the tsdown/Vitest wiring drifts, and transforms fixtures through the same server-side Vite pipeline Vitest uses to assertreact/compiler-runtimeis emitted (hook components, JSX-only modules) and that setup files stay untouched.Includes a minor changeset for
@sanity/plugin-kit(new./vitestexport, published for standalone plugins too). The lockfile diff is intentionally minimal (24 lines) —sanitystays at the6.11.0-next.38main currently pins.Testing
pnpm --filter @repo/react-compiler-parity exec vitest run— 5 passed (parity invariant, compile with/without plugin, JSX-only compile, setup-file skip, assist config)pnpm --filter @sanity/plugin-kit exec vitest run— 62 passed (includes updated package-exports snapshot)pnpm --filter @sanity/table exec vitest run— JSX-only icon components compilepnpm --filter @sanity/document-internationalization exec vitest run— 213 passed, jest-dom matchers still registerpnpm --filter @sanity/color-input exec vitest run— composes with vanilla-extractpnpm build(52 tasks),pnpm lint,pnpm knip,pnpm format— all pass