-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
62 lines (61 loc) · 1.52 KB
/
vite.config.ts
File metadata and controls
62 lines (61 loc) · 1.52 KB
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
57
58
59
60
61
62
import { defineConfig } from 'vite';
import path from 'path';
import terser from '@rollup/plugin-terser';
import { createGLSLPlugin } from './vite-plugins/glsl-minify';
export default defineConfig(() => {
return {
resolve: {
alias: {
'textmode.filters.js': path.resolve(__dirname, 'src/index.ts'),
},
},
server: {
open: '/examples/index.html',
},
plugins: [
// GLSL shader minification plugin - reduces bundle size significantly
createGLSLPlugin(),
],
build: {
minify: 'esbuild',
emptyOutDir: true,
lib: {
entry: path.resolve(__dirname, 'src/index.ts'),
name: 'textmodeFilters',
fileName: (format) => `textmode.filters.${format === 'es' ? 'esm' : format}.js`,
formats: ['es', 'umd'],
},
rollupOptions: {
external: ['textmode.js'],
output: {
globals: {
'textmode.js': 'textmode',
},
},
plugins: [
terser({
compress: {
drop_debugger: true,
ecma: 2020,
toplevel: true,
unsafe: true,
},
mangle: {
toplevel: false,
properties: {
keep_quoted: true,
regex: /^[_$]/,
},
reserved: ['t'],
},
format: {
comments: false,
ecma: 2020,
},
module: true,
}) as any,
],
},
}
};
});