mirror of
https://github.com/withastro/astro.git
synced 2024-12-30 22:03:56 -05:00
Use default import in astro add (#11872)
This commit is contained in:
parent
d1bd1a11f7
commit
9327d56755
2 changed files with 15 additions and 2 deletions
5
.changeset/neat-swans-hear.md
Normal file
5
.changeset/neat-swans-hear.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Fixes `astro add` importing adapters and integrations
|
|
@ -427,7 +427,11 @@ function addIntegration(mod: ProxifiedModule<any>, 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<any>, 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) {
|
||||
|
|
Loading…
Reference in a new issue