Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add node: prefix for Deno compatibility #163

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

karimfromjordan
Copy link
Contributor

This PR adds the node: prefix to Node's modules for compatibility with Deno.

@lukeed
Copy link
Owner

lukeed commented Oct 11, 2024

I had to increase the Node minimum support for this PR to work. Currently, sirv supported Node10+ but and node: was only added in Node 16 and back-ported to Node 14.18

The sibling Polka PR worked because the polka@next already had an exports map, which allowed/guaranteed anyone using ESM to get the node:-containing files, but all legacy/previous CommonJS usage to keep using files that did not have node: in it, which quickly broke many upstream CommonJS users.

This wasnt an option here, as sirv did not already have an exports map, so I couldnt guarantee that ESM users would get the new node: files (thus making this PR useless).

Why? The index.js files were built into build.mjs and build.js outputs. A build script could strip node:-prefixes in build.js (like the Polka PR), leaving them in build.mjs... but since sirv only has "module" mapping, which is now largely ignore/replaced by exports, it's unlikely that Svelte Kit / Deno users would ever see the build.mjs file.

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