summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Ben Holmes <hey@bholmes.dev> 2022-09-09 16:56:07 -0400
committerGravatar GitHub <noreply@github.com> 2022-09-09 16:56:07 -0400
commitd28f7013c2b415cbf6b640f17c9678ef0ac53253 (patch)
tree5d8630d87ae61619f8217a484df813cc8e4aa0af
parentf226b677b821c3257cedc3c94921dc8d397c5ed0 (diff)
downloadastro-d28f7013c2b415cbf6b640f17c9678ef0ac53253.tar.gz
astro-d28f7013c2b415cbf6b640f17c9678ef0ac53253.tar.zst
astro-d28f7013c2b415cbf6b640f17c9678ef0ac53253.zip
Fix `[astro add]` fetch failure (#4703)
* fix: apply fetch polyfill earlier * chore: changeset
-rw-r--r--.changeset/mean-dingos-juggle.md5
-rw-r--r--packages/astro/src/core/add/index.ts2
2 files changed, 6 insertions, 1 deletions
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<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}`);