Remove node-fetch (#2462)

* remove node-fetch

* use webapi polyfill like astro
This commit is contained in:
Jonathan Neal 2022-01-25 11:37:06 -05:00 committed by GitHub
parent ce542cbad3
commit a764264d29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View file

@ -86,7 +86,6 @@
"magic-string": "^0.25.7",
"mime": "^3.0.0",
"morphdom": "^2.6.1",
"node-fetch": "^3.0.0",
"parse5": "^6.0.1",
"path-to-regexp": "^6.2.0",
"postcss": "^8.3.8",

View file

@ -1,5 +1 @@
---
import fetch from 'node-fetch'
---
<span id="already-imported">{typeof fetch}</span>

View file

@ -1,5 +1,5 @@
import { execa } from 'execa';
import fetch from 'node-fetch';
import { polyfill } from '@astropub/webapi';
import fs from 'fs';
import { fileURLToPath } from 'url';
import { loadConfig } from '../dist/core/config.js';
@ -8,6 +8,11 @@ import build from '../dist/core/build/index.js';
import preview from '../dist/core/preview/index.js';
import os from 'os';
// polyfill WebAPIs to globalThis for Node v12, Node v14, and Node v16
polyfill(globalThis, {
exclude: 'window document',
});
/**
* @typedef {import('node-fetch').Response} Response
* @typedef {import('../src/core/dev/index').DevServer} DevServer