-
Notifications
You must be signed in to change notification settings - Fork 197
/
vite.config.ts
48 lines (45 loc) · 1.37 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
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import eslintPlugin from 'vite-plugin-eslint'
import * as path from 'path'
import vueJsx from '@vitejs/plugin-vue-jsx'
import { resolve } from 'path'
import glsl from 'vite-plugin-glsl'
import { readdirSync } from 'fs'
// https://vitejs.dev/config/
const root = path.resolve(__dirname, 'src')
const pagesRoot = path.resolve(__dirname, 'src/pages')
export default defineConfig({
base: process.env.NODE_ENV === 'production' ? '' : '/',
root,
publicDir: path.resolve(__dirname, 'public'),
resolve: {
alias: {
'@': path.resolve(__dirname, 'src')
},
extensions: ['.js', 'ts', '.vue', '.css', '.scss']
},
plugins: [
vue(),
vueJsx(),
eslintPlugin({
include: ['src/**/*.js', 'src/**/*.vue', 'src/*.js', 'src/*.vue'],
exclude: ['src/**/draco/*.js']
}),
glsl({ watch: true })
],
build: {
rollupOptions: {
input: {
main: resolve(root, 'index.html'),
...Object.fromEntries(readdirSync(pagesRoot).map(dir => {
return [
dir,
resolve(pagesRoot, dir, 'index.html')
]
}))
}
},
outDir: path.resolve(__dirname, './dist')
}
})