Skip to content

fix: Use esbuild inject API - #1822

Merged
benmccann merged 1 commit into
masterfrom
esbuild-shims
Jul 6, 2021
Merged

fix: Use esbuild inject API#1822
benmccann merged 1 commit into
masterfrom
esbuild-shims

Conversation

@GrygrFlzr

@GrygrFlzr GrygrFlzr commented Jul 4, 2021

Copy link
Copy Markdown
Member

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

changeset-bot Bot commented Jul 4, 2021

Copy link
Copy Markdown

🦋 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
Copy Markdown
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