diff --git a/package.json b/package.json index 99d7d8b..a046b26 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "typecheck:vue": "pnpm -C ./examples/vue run typecheck" }, "peerDependencies": { - "vite": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" + "vite": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" }, "dependencies": { "@rollup/plugin-inject": "^5.0.5", diff --git a/src/index.ts b/src/index.ts index 35f4aed..4735eaf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -239,10 +239,11 @@ export const nodePolyfills = (options: PolyfillOptions = {}): Plugin => { : {}, }, }, - esbuild: { - // In dev, the global polyfills need to be injected as a banner in order for isolated scripts (such as Vue SFCs) to have access to them. - banner: isDev ? globalShimsBanner : undefined, - }, + // Vite 8+ (Rolldown) replaces esbuild with oxc for JS transforms + ...(isRolldownVite + ? { oxc: { jsxInject: isDev ? globalShimsBanner : undefined } } + : { esbuild: { banner: isDev ? globalShimsBanner : undefined } } + ), optimizeDeps: { exclude: [ ...globalShimPaths,