Skip to content

Conversation

@alexbevi
Copy link

@alexbevi alexbevi commented Oct 9, 2025

Having the trailing slash on the punycode require causes issues when trying to pre-bundle packages for SSR with Vite that may have tr46 as a transitive dependency.

For example (when using @cloudflare/vite-plugin):

Error: Dynamic require of "punycode/" is not supported
    at /workspace/tanstack/new-test/node_modules/.vite/deps_ssr/chunk-PLDDJCW6.js:11:9
    at node_modules/.pnpm/[email protected]/node_modules/tr46/index.js
    at node_modules/.pnpm/[email protected]/node_modules/whatwg-url/lib/url-state-machine.js

@domenic
Copy link
Member

domenic commented Oct 9, 2025

This sounds like a bug in whatever kind of software Vite is; this package is targeted at Node.js.

@domenic domenic closed this Oct 9, 2025
@baileympearson
Copy link

@domenic Yes, Vite probably should handle this and they don't, but is there any reason why we can't just update the import and release a patch? Imports with trailing slashes are not commonly used in the Nodejs ecosystem and Node's resolution algorithm works the same if there isn't a trailing slash.

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.

3 participants