-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
62 lines (56 loc) · 1.72 KB
/
vite.config.js
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
// vite.config.js
import { resolve } from 'node:path';
import glsl from 'vite-plugin-glsl';
import handlebars from 'vite-plugin-handlebars';
import { defineConfig } from 'vite'
const pageData = {
'/index.html': {
title: 'Main Page',
},
'/nested/subpage.html': {
title: 'Sub Page',
},
};
export default defineConfig({
base: './',
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
shader: resolve(__dirname, 'shader/index.html'),
acrossTheSystems: resolve(__dirname, 'skeleton/index.html'),
applications: resolve(__dirname, 'applications/index.html'),
grid: resolve(__dirname, 'applications/basic-grid/index.html'),
coordinates: resolve(__dirname, 'learning/index.html'),
},
},
},
plugins: [glsl(
{
include: [ // Glob pattern, or array of glob patterns to import
'**/*.glsl', '**/*.wgsl',
'**/*.vert', '**/*.frag',
'**/*.vs', '**/*.fs'
],
exclude: undefined, // Glob pattern, or array of glob patterns to ignore
warnDuplicatedImports: true, // Warn if the same chunk was imported multiple times
defaultExtension: 'glsl', // Shader suffix when no extension is specified
compress: false, // Compress output shader code
watch: true, // Recompile shader on change
root: '/' // Directory for root imports
}),
handlebars({
partialDirectory: resolve(__dirname, './src/partials'),
context(pagePath) {
const p = String(pagePath).split('/').pop()
return pageData[p];
},
}),
],
lib: {
formats: ['es']
},
worker: {
format: 'es'
}
})