diff --git a/.changeset/swift-islands-promise.md b/.changeset/swift-islands-promise.md new file mode 100644 index 000000000000..0f2924287847 --- /dev/null +++ b/.changeset/swift-islands-promise.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Correctly emit mode when passing `node` to the command `astro add` diff --git a/packages/astro/src/core/add/index.ts b/packages/astro/src/core/add/index.ts index 02e49b7545c6..d90075ce78a5 100644 --- a/packages/astro/src/core/add/index.ts +++ b/packages/astro/src/core/add/index.ts @@ -457,7 +457,21 @@ async function setAdapter(ast: t.File, adapter: IntegrationInfo, exportName: str return false; }) as t.ObjectProperty | undefined; - const adapterCall = t.callExpression(adapterId, []); + let adapterCall; + switch (adapter.id) { + // the node adapter requires a mode + case 'node': { + adapterCall = t.callExpression(adapterId, [ + t.objectExpression([ + t.objectProperty(t.identifier('mode'), t.stringLiteral('standalone')), + ]), + ]); + break; + } + default: { + adapterCall = t.callExpression(adapterId, []); + } + } if (!adapterProp) { configObject.properties.push(t.objectProperty(t.identifier('adapter'), adapterCall));