diff options
author | 2023-02-22 20:53:56 +0000 | |
---|---|---|
committer | 2023-02-22 20:53:56 +0000 | |
commit | 63dda6dedd4c6ea1d5ce72e9cf3fe5f88339a927 (patch) | |
tree | 66fe1d45ec7ae92e68689cdbbd6eb2978f41cefe | |
parent | 3b1871a72612037e35697dd5693aadebac740d28 (diff) | |
download | astro-63dda6dedd4c6ea1d5ce72e9cf3fe5f88339a927.tar.gz astro-63dda6dedd4c6ea1d5ce72e9cf3fe5f88339a927.tar.zst astro-63dda6dedd4c6ea1d5ce72e9cf3fe5f88339a927.zip |
fix(astro): correctly change configuration when node adapter is added (#6333)
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
Diffstat (limited to '')
-rw-r--r-- | .changeset/swift-islands-promise.md | 5 | ||||
-rw-r--r-- | packages/astro/src/core/add/index.ts | 16 |
2 files changed, 20 insertions, 1 deletions
diff --git a/.changeset/swift-islands-promise.md b/.changeset/swift-islands-promise.md new file mode 100644 index 000000000..0f2924287 --- /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 02e49b754..d90075ce7 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)); |