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

fix: Use esbuild inject API #1822

Merged
merged 1 commit into from
Jul 6, 2021
Merged

fix: Use esbuild inject API #1822

merged 1 commit into from
Jul 6, 2021

Conversation

GrygrFlzr
Copy link
Member

@GrygrFlzr GrygrFlzr commented Jul 4, 2021

Fixes #1733.

Purpose

This makes the adapters use esbuild's inject API:

This option allows you to automatically replace a global variable with an import from another file. This can be a useful tool for adapting code that you don't control to a new environment.

In particular, this guarantees:

  • Execution order before all user/kit code in build output
  • Properly polyfilled bindings for fetch etc

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 pnpx changeset and following the prompts

@changeset-bot
Copy link

changeset-bot bot commented Jul 4, 2021

🦋 Changeset detected

Latest commit: d860475

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

@GrygrFlzr GrygrFlzr added the adapters - general Support for functionality general to all adapters label Jul 4, 2021
@benmccann
Copy link
Member

The hn.svelte.dev example is printing ~20 warnings now when I run npm run build:

../../packages/adapter-netlify/files/shims.js:1:9: warning: Import "fetch" will always be undefined because the file "../../packages/kit/dist/install-fetch.js" has no exports
1 │ export { fetch, Response, Request, Headers } from '@sveltejs/kit/install-fetch'; // eslint-disable-line import/no-unresolved
╵ ~~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters - general Support for functionality general to all adapters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node Adapter: "Dynamic require of "x" is not supported"
2 participants