Describe the bug
See here: https://github.com/vitejs/vite/blob/main/packages/vite/src/node/optimizer/scan.ts#L399
Not sure why but we aren't passing any user/plugin-specified transform options. This has caused me to be able to reproducibly cause the following error.
(!) Failed to run dependency scan. Skipping dependency pre-bundling. Error: The following dependencies are imported but could not be resolved:
react/jsx-runtime (imported by C:/repos/vite-8-transform-bug-repro/src/main.tsx)
Are they installed?
at file:///C:/repos/vite-8-transform-bug-repro/node_modules/.pnpm/vite@8.0.10/node_modules/vite/dist/node/chunks/node.js:31398:33
at async file:///C:/repos/vite-8-transform-bug-repro/node_modules/.pnpm/vite@8.0.10/node_modules/vite/dist/node/chunks/node.js:23222:15
this is despite having specified the following config:
import { defineConfig } from "vite";
export default defineConfig({
oxc: {
jsx: {
pragma: "_jsx",
pragmaFrag: "_jsxFragment",
importSource: "kiru",
runtime: "automatic",
},
},
});
Issue is solved by adding the following (I'm sure this is not the correct approach, but it does work):
const result = transformSync(id, contents, {
lang: loader,
tsconfig: false,
...environment.pluginContainer._resolvedRollupOptions.transform // this
});
Reproduction
https://github.com/LankyMoose/vite-8-transform-bug-repro
Steps to reproduce
To reproduce:
- install deps
- run 'dev' script
- should error. only happens once.
To repeat, delete node_modules/.vite, and run dev again.
System Info
System:
OS: Windows 11 10.0.26200
CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11700K @ 3.60GHz
Memory: 2.36 GB / 15.79 GB
Binaries:
Node: 22.20.0 - C:\Users\rob\AppData\Local\pnpm\node.EXE
npm: 10.9.3 - C:\Users\rob\AppData\Local\pnpm\npm.CMD
pnpm: 10.28.0 - C:\Users\rob\AppData\Local\pnpm\pnpm.CMD
bun: 1.3.5 - C:\Users\rob\.bun\bin\bun.EXE
Browsers:
Chrome: 147.0.7727.103
Edge: Chromium (140.0.3485.54)
npmPackages:
vite: ^8.0.10 => 8.0.10
Used Package Manager
pnpm
Logs
No response
Validations
Describe the bug
See here: https://github.com/vitejs/vite/blob/main/packages/vite/src/node/optimizer/scan.ts#L399
Not sure why but we aren't passing any user/plugin-specified transform options. This has caused me to be able to reproducibly cause the following error.
this is despite having specified the following config:
Issue is solved by adding the following (I'm sure this is not the correct approach, but it does work):
Reproduction
https://github.com/LankyMoose/vite-8-transform-bug-repro
Steps to reproduce
To reproduce:
To repeat, delete node_modules/.vite, and run dev again.
System Info
System: OS: Windows 11 10.0.26200 CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11700K @ 3.60GHz Memory: 2.36 GB / 15.79 GB Binaries: Node: 22.20.0 - C:\Users\rob\AppData\Local\pnpm\node.EXE npm: 10.9.3 - C:\Users\rob\AppData\Local\pnpm\npm.CMD pnpm: 10.28.0 - C:\Users\rob\AppData\Local\pnpm\pnpm.CMD bun: 1.3.5 - C:\Users\rob\.bun\bin\bun.EXE Browsers: Chrome: 147.0.7727.103 Edge: Chromium (140.0.3485.54) npmPackages: vite: ^8.0.10 => 8.0.10Used Package Manager
pnpm
Logs
No response
Validations