fix(vite)!: replace buffer polyfill with data-uri-to-buffer shim#2054
Conversation
Remove vite-plugin-node-polyfills and the buffer package dependency. Instead of injecting a global Buffer polyfill, alias data-uri-to-buffer (used by stacktracey/get-source for inline source map parsing in the dev error page) to a tiny in-repo shim that returns a Uint8Array. This avoids: - Complex CJS/ESM import.meta.url issues during Vite config loading - pnpm symlink resolution problems - Injected <script> tags in every dev page load - The full buffer polyfill dependency overhead
✅ Deploy Preview for cedarjs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
The exclude:['util'] was needed because vite-plugin-node-polyfills brought in node-util (Browserify's util polyfill), which would incorrectly resolve instead of Node's built-in util, causing TextEncoder to be missing. Since that dependency is now removed, the workaround is no longer needed.
Greptile SummaryThis PR replaces the Vite Buffer polyfill with a focused data URI shim. The main changes are:
Confidence Score: 4/5This is close, but the remaining dev-server resolution issue should be fixed before merging.
packages/vite/src/devFeServer.ts Important Files Changed
Reviews (2): Last reviewed commit: "virtual module" | Re-trigger Greptile |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many -t build:pack --exclude create-ceda... |
✅ Succeeded | 3s | View ↗ |
nx run-many -t build |
✅ Succeeded | 3m 12s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-07-07 11:49:56 UTC
|
The changes in this PR are now available on npm. Try them out by running Or try it in a new app with |

Remove vite-plugin-node-polyfills and the buffer package dependency. Instead of injecting a global Buffer polyfill, alias data-uri-to-buffer (used by stacktracey/get-source for inline source map parsing in the dev error page) to a tiny in-repo shim that returns a Uint8Array.
This avoids:
<script>tags in every dev page load