diff options
-rw-r--r-- | .changeset/lovely-elephants-peel.md | 5 | ||||
-rw-r--r-- | packages/astro/src/core/add/index.ts | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/.changeset/lovely-elephants-peel.md b/.changeset/lovely-elephants-peel.md new file mode 100644 index 000000000..7dfe25b9c --- /dev/null +++ b/.changeset/lovely-elephants-peel.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Remove redundant comments when `astro add` update `astro.config.mjs` diff --git a/packages/astro/src/core/add/index.ts b/packages/astro/src/core/add/index.ts index d90075ce7..3abe00db9 100644 --- a/packages/astro/src/core/add/index.ts +++ b/packages/astro/src/core/add/index.ts @@ -507,7 +507,7 @@ async function updateAstroConfig({ let output = await generate(ast); const comment = '// https://astro.build/config'; const defaultExport = 'export default defineConfig'; - output = output.replace(` ${comment}`, ''); + output = output.replace(`\n${comment}`, ''); output = output.replace(`${defaultExport}`, `\n${comment}\n${defaultExport}`); if (input === output) { |