diff options
author | 2023-12-04 19:59:35 +0000 | |
---|---|---|
committer | 2023-12-05 01:29:35 +0530 | |
commit | 0968cb1a373b1101a649035d2ea2210d3d6412dc (patch) | |
tree | 720a59029e482101b4d1859f2f1945dc1577442a | |
parent | 5d566cfeca712f9439abe5fea2c8c838f085dcd9 (diff) | |
download | astro-0968cb1a373b1101a649035d2ea2210d3d6412dc.tar.gz astro-0968cb1a373b1101a649035d2ea2210d3d6412dc.tar.zst astro-0968cb1a373b1101a649035d2ea2210d3d6412dc.zip |
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>
-rw-r--r-- | .changeset/chatty-poems-doubt.md | 5 | ||||
-rw-r--r-- | packages/astro/src/core/compile/compile.ts | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/.changeset/chatty-poems-doubt.md b/.changeset/chatty-poems-doubt.md new file mode 100644 index 000000000..32bc05c9d --- /dev/null +++ b/.changeset/chatty-poems-doubt.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes an issue where html annotations relevant only to the dev server were included in the production build. diff --git a/packages/astro/src/core/compile/compile.ts b/packages/astro/src/core/compile/compile.ts index 8a187e652..2877d6a3e 100644 --- a/packages/astro/src/core/compile/compile.ts +++ b/packages/astro/src/core/compile/compile.ts @@ -48,7 +48,7 @@ export async function compile({ resultScopedSlot: true, transitionsAnimationURL: 'astro/components/viewtransitions.css', annotateSourceFile: - !viteConfig.isProduction && astroConfig.devToolbar && astroConfig.devToolbar.enabled, + viteConfig.command === "serve" && astroConfig.devToolbar && astroConfig.devToolbar.enabled, preprocessStyle: createStylePreprocessor({ filename, viteConfig, |