forked from hplush/slowreader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
34 lines (33 loc) · 886 Bytes
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { nodeResolve } from '@rollup/plugin-node-resolve'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { defineConfig } from 'vite'
export default defineConfig(() => ({
build: {
assetsInlineLimit: 0
},
plugins: [
svelte(),
nodeResolve({
extensions: ['.js', '.ts']
}),
{
enforce: 'pre',
name: 'html-transform',
transformIndexHtml(html) {
if (process.env.NODE_ENV === 'development' || process.env.STAGING) {
return html
.replace(
'<link rel="icon" href="/favicon.ico" sizes="32x32" />',
''
)
.replace(
/<link rel="icon" href="[^"]+" type="image\/svg\+xml" \/>/,
'<link rel="icon" href="/campfire.svg" type="image/svg+xml" />'
)
} else {
return html
}
}
}
]
}))