Skip to content

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