Skip to content

fix: use oxc instead of esbuild when Rolldown is detected#149

Open
AlexDemzz wants to merge 1 commit intodavidmyersdev:mainfrom
AlexDemzz:fix/vite-8-compat
Open

fix: use oxc instead of esbuild when Rolldown is detected#149
AlexDemzz wants to merge 1 commit intodavidmyersdev:mainfrom
AlexDemzz:fix/vite-8-compat

Conversation

@AlexDemzz
Copy link

@AlexDemzz AlexDemzz commented Mar 14, 2026

Fixes #142

Vite 8 dropped esbuild in favor of oxc for JS transforms. The plugin was still setting esbuild.banner unconditionally, which produces this warning:

`esbuild` option was specified by "vite-plugin-node-polyfills" plugin.
This option is deprecated, please use `oxc` instead

The fix uses the existing isRolldownVite check to pick between oxc.jsxInject and esbuild.banner for dev banner injection, same pattern already used for optimizeDeps.rolldownOptions vs esbuildOptions.

-        esbuild: {
-          banner: isDev ? globalShimsBanner : undefined,
-        },
+        ...(isRolldownVite
+          ? { oxc: { jsxInject: isDev ? globalShimsBanner : undefined } }
+          : { esbuild: { banner: isDev ? globalShimsBanner : undefined } }
+        ),

Also adds ^8.0.0 to peerDependencies.

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 davidmyersdev#142
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant