Skip to content

Commit a51cf4d

Browse files
committed
Fix Vite config plugin typing
1 parent be85339 commit a51cf4d

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

vite.config.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineConfig, loadEnv } from 'vite'
1+
import { defineConfig, loadEnv, type HtmlTagDescriptor, type PluginOption } from 'vite'
22
import solid from 'vite-plugin-solid'
33
import devtools from 'solid-devtools/vite'
44
import { sentryVitePlugin } from '@sentry/vite-plugin'
@@ -9,7 +9,7 @@ import { Icons } from './src/components/material/Icon'
99

1010
export default defineConfig(({ mode }) => {
1111
const env = loadEnv(mode, process.cwd(), '')
12-
const plugins = [
12+
const plugins: PluginOption[] = [
1313
devtools(),
1414
solid({
1515
ssr: false,
@@ -57,20 +57,21 @@ export default defineConfig(({ mode }) => {
5757
}),
5858
{
5959
name: 'inject-material-symbols',
60-
transformIndexHtml(html) {
60+
transformIndexHtml(html: string) {
6161
const icons = Icons.toSorted().join(',')
62+
const tags: HtmlTagDescriptor[] = [
63+
{
64+
tag: 'link',
65+
attrs: {
66+
rel: 'stylesheet',
67+
href: `https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,400,0..1,0&icon_names=${icons}&display=block`,
68+
},
69+
injectTo: 'head',
70+
},
71+
]
6272
return {
6373
html,
64-
tags: [
65-
{
66-
tag: 'link',
67-
attrs: {
68-
rel: 'stylesheet',
69-
href: `https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,400,0..1,0&icon_names=${icons}&display=block`,
70-
},
71-
injectTo: 'head',
72-
},
73-
],
74+
tags,
7475
}
7576
},
7677
},

0 commit comments

Comments
 (0)