Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/strong-owls-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@sveltejs/adapter-netlify': patch
'@sveltejs/adapter-node': patch
'@sveltejs/adapter-vercel': patch
---

Polyfill fetch before running any app code
3 changes: 2 additions & 1 deletion packages/adapter-netlify/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import json from '@rollup/plugin-json';
export default [
{
input: {
handler: 'src/handler.js'
handler: 'src/handler.js',
shims: 'src/shims.js'
},
output: [
{
Expand Down
4 changes: 1 addition & 3 deletions packages/adapter-netlify/src/handler.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { __fetch_polyfill } from '@sveltejs/kit/install-fetch';
import './shims';
import { App } from './server/app.js';

__fetch_polyfill();

/**
*
* @param {import('@sveltejs/kit').SSRManifest} manifest
Expand Down
2 changes: 2 additions & 0 deletions packages/adapter-netlify/src/shims.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { __fetch_polyfill } from '@sveltejs/kit/install-fetch';
__fetch_polyfill();
3 changes: 2 additions & 1 deletion packages/adapter-node/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export default [
{
input: {
index: 'src/index.js',
handler: 'src/handler.js'
handler: 'src/handler.js',
shims: 'src/shims.js'
},
output: {
dir: 'files',
Expand Down
4 changes: 1 addition & 3 deletions packages/adapter-node/src/handler.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import './shims';
import fs from 'fs';
import path from 'path';
import sirv from 'sirv';
import { fileURLToPath } from 'url';
import { getRawBody } from '@sveltejs/kit/node';
import { __fetch_polyfill } from '@sveltejs/kit/install-fetch';

// @ts-ignore
import { App } from 'APP';
import { manifest } from 'MANIFEST';

__fetch_polyfill();

const app = new App(manifest);

const __dirname = path.dirname(fileURLToPath(import.meta.url));
Expand Down
2 changes: 2 additions & 0 deletions packages/adapter-node/src/shims.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { __fetch_polyfill } from '@sveltejs/kit/install-fetch';
__fetch_polyfill();
4 changes: 1 addition & 3 deletions packages/adapter-vercel/files/entry.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { __fetch_polyfill } from '@sveltejs/kit/install-fetch';
import './shims';
import { getRawBody } from '@sveltejs/kit/node';
import { App } from 'APP';
import { manifest } from 'MANIFEST';

__fetch_polyfill();

const app = new App(manifest);

export default async (req, res) => {
Expand Down
2 changes: 2 additions & 0 deletions packages/adapter-vercel/files/shims.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { __fetch_polyfill } from '@sveltejs/kit/install-fetch';
__fetch_polyfill();