Skip to content

Conversation

Rich-Harris
Copy link
Member

@Rich-Harris Rich-Harris commented May 15, 2022

This replaces @sveltejs/kit/install-fetch with @sveltejs/kit/node/polyfills, and adds crypto to the list of web APIs that are guaranteed to be present.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. All changesets should be patch until SvelteKit 1.0

@changeset-bot
Copy link

changeset-bot bot commented May 15, 2022

🦋 Changeset detected

Latest commit: 453bc68

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@sveltejs/adapter-netlify Patch
@sveltejs/adapter-node Patch
@sveltejs/adapter-vercel Patch
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ghostdevv
Copy link
Member

Will this mean that libraries that rely on node dependencies in a non-node environment such as CloudFlare Pages have a chance of working? i.e. stripe

@Rich-Harris
Copy link
Member Author

No, it's the opposite — it's bringing the Node environment up to date with other more web-like ones, where fetch and crypto etc are already universally supported. If people need to use Node-specific dependencies in non-Node environments, they will need to use things like https://www.npmjs.com/package/rollup-plugin-node-builtins (though some of these have significant caveats).

Ideally, those libraries should be updated to use web APIs, instead of assuming they're running in Node.

@benmccann
Copy link
Member

Just FYI, Vite is likely switching to node-native-fetch: vitejs/vite#8157

@Rich-Harris
Copy link
Member Author

We really need to use undici, since that unblocks #3419node-fetch-native won't work for us

@Rich-Harris
Copy link
Member Author

Added crypto to the web standards section of the docs, so marking this ready for review. The other stuff (upgrading to undici, etc) can wait until another time, no point waiting on that for everything else.

@Rich-Harris Rich-Harris marked this pull request as ready for review May 23, 2022 21:01
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