-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
56 lines (51 loc) · 1.03 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { defineConfig } from 'vite';
import babel from '@rollup/plugin-babel';
import min from '@minify-html/node';
export default defineConfig({
base: '/skeetgen/',
optimizeDeps: {
include: ['@intrnl/jsx-to-string/runtime'],
},
build: {
minify: 'terser',
sourcemap: true,
target: 'esnext',
modulePreload: {
polyfill: false,
},
rollupOptions: {
input: {
index: './index.html',
export: './export.html',
},
},
terserOptions: {
compress: {
passes: 2,
},
},
},
esbuild: {
target: 'es2022',
},
plugins: [
{
enforce: 'pre',
...babel({
babelrc: false,
babelHelpers: 'bundled',
extensions: ['.tsx'],
plugins: [['@babel/plugin-syntax-typescript', { isTSX: true }], ['@intrnl/jsx-to-string/babel']],
}),
},
{
name: 'minify-html',
transformIndexHtml(source) {
const encoder = new TextEncoder();
const decoder = new TextDecoder();
const buffer = min.minify(encoder.encode(source), {});
return { tags: [], html: decoder.decode(buffer) };
},
},
],
});