fix: build root shims export - #161
Open
mojobeeping wants to merge 1 commit into
Open
Conversation
chybisov
added a commit
to lifinance/widget
that referenced
this pull request
Aug 20, 2026
The old note said vite-plugin-env-compatible was the problem and that swapping in vite-plugin-node-polyfills would fix it. That is no longer true under Vite 8. The Dynamic SDK reads a bare `process` global (nextTick/versions/emit) and imports `buffer/index.js`, so it does need Node shims. But vite-plugin-node-polyfills, while advertising a Vite 8 peer range, aliases its own shims by bare specifier, and its exports map still carries legacy trailing-slash keys that resolve to files. Rolldown rejects those: Expecting folder to folder mapping. ".../vite-plugin-node-polyfills/package.json" should end with "/" Verified on both 0.26.0 and 0.28.0 (identical exports maps), in `vite build` and again in dev dependency pre-bundling. Upstream fixes are open but unreleased: davidmyersdev/vite-plugin-node-polyfills#161 and #154, with #158 and #140 reporting this exact error. Dropping the plugin entirely gets the example to build once `buffer` is a real dependency — the SDK's own polyfills.js assigns window.global/window.Buffer — but the free `process` global remains undefined at runtime. The @dynamic-labs v5 upgrade itself is sound: it type-checks and bundles. Only the browser polyfill setup is blocked.
This was referenced Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restores the published
vite-plugin-node-polyfills/shimsexport by building the aggregate shims entrypoint.package.jsoncurrently exports./shimsto./shims/dist/index.jsand./shims/dist/index.cjs, but the build only emitsbuffer,global, andprocessshims. A clean install ofvite-plugin-node-polyfills@0.28.0fails when importing the advertised root shims subpath:This PR:
shims/index.tsas the aggregate shim entrypointbuild:shims:indexsopnpm run build:shimsemitsshims/dist/index.jsandshims/dist/index.cjsVerification
Packed tarball clean-consumer proof: