diff --git a/.changeset/neat-swans-hear.md b/.changeset/neat-swans-hear.md new file mode 100644 index 0000000000..22657a94f0 --- /dev/null +++ b/.changeset/neat-swans-hear.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes `astro add` importing adapters and integrations diff --git a/packages/astro/src/cli/add/index.ts b/packages/astro/src/cli/add/index.ts index 2b230048ce..f263904cbb 100644 --- a/packages/astro/src/cli/add/index.ts +++ b/packages/astro/src/cli/add/index.ts @@ -427,7 +427,11 @@ function addIntegration(mod: ProxifiedModule, integration: IntegrationInfo) const integrationId = toIdent(integration.id); if (!mod.imports.$items.some((imp) => imp.local === integrationId)) { - mod.imports.$append({ imported: integrationId, from: integration.packageName }); + mod.imports.$append({ + imported: 'default', + local: integrationId, + from: integration.packageName, + }); } config.integrations ??= []; @@ -448,7 +452,11 @@ export function setAdapter(mod: ProxifiedModule, adapter: IntegrationInfo) const adapterId = toIdent(adapter.id); if (!mod.imports.$items.some((imp) => imp.local === adapterId)) { - mod.imports.$append({ imported: adapterId, from: adapter.packageName }); + mod.imports.$append({ + imported: 'default', + local: adapterId, + from: adapter.packageName, + }); } if (!config.output) {