Skip to content

Commit 0968cb1

Browse files
lilnasybluwy
andauthored
fix(astro compiler): check vite command to decide on "annotateSourceFile" (#9275)
* prevent annotations in build * add changeset * Apply suggestions from code review Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> --------- Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
1 parent 5d566cf commit 0968cb1

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

.changeset/chatty-poems-doubt.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Fixes an issue where html annotations relevant only to the dev server were included in the production build.

packages/astro/src/core/compile/compile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export async function compile({
4848
resultScopedSlot: true,
4949
transitionsAnimationURL: 'astro/components/viewtransitions.css',
5050
annotateSourceFile:
51-
!viteConfig.isProduction && astroConfig.devToolbar && astroConfig.devToolbar.enabled,
51+
viteConfig.command === "serve" && astroConfig.devToolbar && astroConfig.devToolbar.enabled,
5252
preprocessStyle: createStylePreprocessor({
5353
filename,
5454
viteConfig,

0 commit comments

Comments
 (0)