Skip to content

Replace vite-plugin-node-polyfills with @rolldown/plugin-node-polyfills#1095

Closed
Copilot wants to merge 4 commits intomasterfrom
copilot/update-vite-to-v8
Closed

Replace vite-plugin-node-polyfills with @rolldown/plugin-node-polyfills#1095
Copilot wants to merge 4 commits intomasterfrom
copilot/update-vite-to-v8

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 14, 2026

vite-plugin-node-polyfills is incompatible with Vite 8's Rolldown bundler. This switches to @rolldown/plugin-node-polyfills, the official Rolldown replacement.

Changes

  • package.json: Remove vite-plugin-node-polyfills; @rolldown/plugin-node-polyfills was already added in the Vite 8 upgrade PR
  • vite.config.ts:
    • Switch to default import from @rolldown/plugin-node-polyfills
    • Add enforce: "pre" — without it, vite:resolve/oxcResolvePlugin externalizes Node built-ins (buffer, path) before the polyfill's resolveId hook can intercept them, since Vite places its internal resolver between prePlugins and normalPlugins
    • Pass the plugin into scriptViteConfig and htmlViteConfig inside webExtension() — that plugin spawns separate Vite 6 sub-builds using its own bundled Vite instance, which don't inherit top-level plugins
// enforce: "pre" is required in both main config and sub-build configs
{ ...nodePolyfills(), enforce: "pre" as const }

The options.transform.inject returned by the plugin is Rolldown-specific and produces a harmless Unknown input options: transform warning in the Vite 6 Rollup sub-builds, but correctly injects Buffer/process/global shims in the main Vite 8/Rolldown build.


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Co-authored-by: Rhilip <13842140+Rhilip@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Vite to version 8 chore: update Vite to v8 Mar 14, 2026
Copilot AI requested a review from Rhilip March 14, 2026 03:39
Copilot AI and others added 2 commits March 25, 2026 14:48
Copilot AI changed the title chore: update Vite to v8 Replace vite-plugin-node-polyfills with @rolldown/plugin-node-polyfills Mar 25, 2026
@Rhilip
Copy link
Copy Markdown
Collaborator

Rhilip commented Mar 25, 2026

choked

@Rhilip Rhilip closed this Mar 25, 2026
@Rhilip Rhilip deleted the copilot/update-vite-to-v8 branch March 26, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants