Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/astro/src/vite-plugin-head/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function configHeadVitePlugin(): vite.Plugin {
if (result) {
let info = this.getModuleInfo(result.id);
const astro = info && getAstroMetadata(info);
if (astro) {
if (astro && isRunnableDevEnvironment(environment)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this not work with other envionrments?

Copy link
Member Author

@ematipico ematipico Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the question, but without this guard, the Cloudflare plugin emits errors

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant remove the guard in configureServer instead, so that it populates environment and can run in workerd too

if (astro.propagation === 'self' || astro.propagation === 'in-tree') {
propagateMetadata.call(this, importer, 'propagation', 'in-tree');
}
Expand All @@ -77,6 +77,9 @@ export default function configHeadVitePlugin(): vite.Plugin {
}
},
transform(source, id) {
if (!isRunnableDevEnvironment(environment)) {
return;
}
// TODO This could probably be removed now that this is handled in resolveId
let info = this.getModuleInfo(id);
if (info && getAstroMetadata(info)?.containsHead) {
Expand Down
Loading