Remove node-fetch
(#2462)
* remove node-fetch * use webapi polyfill like astro
This commit is contained in:
parent
ce542cbad3
commit
a764264d29
3 changed files with 6 additions and 6 deletions
|
@ -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",
|
||||
|
|
|
@ -1,5 +1 @@
|
|||
---
|
||||
import fetch from 'node-fetch'
|
||||
---
|
||||
|
||||
<span id="already-imported">{typeof fetch}</span>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue