Fix [astro add] fetch failure (#4703)

* fix: apply fetch polyfill earlier

* chore: changeset
This commit is contained in:
Ben Holmes 2022-09-09 16:56:07 -04:00 committed by GitHub
parent f226b677b8
commit d28f7013c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix: [astro add] Apply fetch polyfill before running

View file

@ -57,6 +57,7 @@ const OFFICIAL_ADAPTER_TO_IMPORT_MAP: Record<string, string> = {
};
export default async function add(names: string[], { cwd, flags, logging, telemetry }: AddOptions) {
applyPolyfill();
if (flags.help || names.length === 0) {
printHelp({
commandName: 'astro add',
@ -159,7 +160,6 @@ export default async function add(names: string[], { cwd, flags, logging, teleme
const rawConfigPath = await resolveConfigPath({ cwd, flags });
let configURL = rawConfigPath ? pathToFileURL(rawConfigPath) : undefined;
applyPolyfill();
if (configURL) {
debug('add', `Found config at ${configURL}`);