From d28f7013c2b415cbf6b640f17c9678ef0ac53253 Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Fri, 9 Sep 2022 16:56:07 -0400 Subject: [PATCH] Fix `[astro add]` fetch failure (#4703) * fix: apply fetch polyfill earlier * chore: changeset --- .changeset/mean-dingos-juggle.md | 5 +++++ packages/astro/src/core/add/index.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/mean-dingos-juggle.md diff --git a/.changeset/mean-dingos-juggle.md b/.changeset/mean-dingos-juggle.md new file mode 100644 index 000000000..8dfdfeeed --- /dev/null +++ b/.changeset/mean-dingos-juggle.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix: [astro add] Apply fetch polyfill before running diff --git a/packages/astro/src/core/add/index.ts b/packages/astro/src/core/add/index.ts index efcf75789..c655dab5d 100644 --- a/packages/astro/src/core/add/index.ts +++ b/packages/astro/src/core/add/index.ts @@ -57,6 +57,7 @@ const OFFICIAL_ADAPTER_TO_IMPORT_MAP: Record = { }; 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}`);