-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
vite.config.ts
73 lines (71 loc) · 2.02 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { templateCompilerOptions } from '@tresjs/core'
import vue from '@vitejs/plugin-vue'
import { bold, gray, lightGreen, magenta } from 'kolorist'
import { resolve } from 'pathe'
import analyze from 'rollup-plugin-analyzer'
import { visualizer } from 'rollup-plugin-visualizer'
import { defineConfig } from 'vite'
import banner from 'vite-plugin-banner'
import dts from 'vite-plugin-dts'
import pkg from './package.json'
// eslint-disable-next-line no-console
console.log(`${lightGreen('▲')} ${gray('■')} ${magenta('𝗫')} ${bold('Tres/post-processing')} v${pkg.version}`)
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
'/@': resolve(__dirname, './src'),
},
dedupe: ['@tresjs/core', '@vueuse/core'],
},
plugins: [
vue(templateCompilerOptions),
dts({
insertTypesEntry: true,
}),
banner({
content: `/**\n * name: ${pkg.name}\n * version: v${
pkg.version
}\n * (c) ${new Date().getFullYear()}\n * description: ${pkg.description}\n * author: ${pkg.author}\n */`,
}),
],
build: {
copyPublicDir: false,
watch: {
include: [resolve(__dirname, 'src')],
},
lib: {
entry: {
three: resolve(__dirname, 'src/core/three/index.ts'),
pmndrs: resolve(__dirname, 'src/core/pmndrs/index.ts'),
},
formats: ['es'],
},
rollupOptions: {
plugins: [
analyze(),
visualizer({
gzipSize: true,
brotliSize: true,
open: false,
}),
],
external: ['three', 'vue', '@tresjs/core', 'postprocessing', '@vueuse/core'],
output: {
entryFileNames: '[name].js',
exports: 'named',
format: 'es',
globals: {
'@tresjs/core': 'TresjsCore',
'three': 'Three',
'vue': 'Vue',
'postprocessing': 'Postprocessing',
'@vueuse/core': 'VueUseCore',
},
},
},
},
optimizeDeps: {
exclude: ['three', 'vue', '@tresjs/core', 'postprocessing', '@vueuse/core'],
},
})