Skip to content

Commit fc939b2

Browse files
committed
fix: 🐛 html tag location in head
closes #7
1 parent 7f870bc commit fc939b2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ class HtmlTag implements HtmlTagDescriptor {
2626
}
2727
}
2828

29+
class HtmlHeadTag extends HtmlTag {
30+
injectTo = 'head' as const;
31+
}
32+
2933
export type ViteCspPluginOptions = typeof DEFAULT_OPTIONS;
3034

3135
type ViteCspPluginOpts = Partial<ViteCspPluginOptions>
@@ -243,7 +247,7 @@ function createViteCspPlugin(...opts: ([PolicyOptions, ViteCspPluginOpts] | [Vit
243247
if (inject) {
244248
return Object.entries(parsedHeaders)
245249
.filter(([k]) => injectReporting || !k.includes('Report'))
246-
.map(([k, v]) => new HtmlTag('meta', {
250+
.map(([k, v]) => new HtmlHeadTag('meta', {
247251
'http-equiv': k,
248252
content: v,
249253
}));

0 commit comments

Comments
 (0)