From e53c9b5796bb90847990c4a3c8aa7e76a6a65a64 Mon Sep 17 00:00:00 2001 From: AlexDemzz Date: Sat, 14 Mar 2026 11:11:52 +0100 Subject: [PATCH] fix: use oxc instead of esbuild when Rolldown is detected Vite 8 dropped esbuild in favor of oxc for JS transforms. The plugin was still setting `esbuild.banner` unconditionally, which triggers a deprecation warning on Vite 8. This uses the existing `isRolldownVite` check to pick between `oxc.jsxInject` and `esbuild.banner` for dev banner injection, matching how `optimizeDeps` already branches between rolldownOptions and esbuildOptions. Also adds ^8.0.0 to peerDependencies. Closes #142 --- package.json | 2 +- src/index.ts | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) 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,