-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.node.config.js
55 lines (53 loc) · 1.34 KB
/
vite.node.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
// https://vitejs.dev/config/
import legacy from '@vitejs/plugin-legacy'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import { fileURLToPath, URL } from 'url'
import { defineConfig } from 'vite'
export default defineConfig(({ command, mode }) => {
const pkg = require('./package.json')
const config = {
define: {
__APP_VERSION__: JSON.stringify(pkg.version),
},
build: {
outDir: '../dist/cli',
emptyOutDir: true,
rollupOptions: {
treeshake: 'smallest',
input: {
cli: path.resolve(__dirname, 'src/cli.js'),
'gcode-thread-worker': path.resolve(
__dirname,
'src/gcode-thread-worker.js',
),
'outline-thread-worker': path.resolve(
__dirname,
'src/outline-thread-worker.js',
),
},
},
},
esbuild: {
keepNames: true,
},
ssr: {
noExternal: ['cation', 'adapter'],
},
legacy: {
buildSsrCjsExternalHeuristics: true,
},
plugins: [vue(), legacy({ targets: ['node 14'] })],
root: 'src',
server: {},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
adapter: fileURLToPath(
new URL('./src/services/adapter/node.js', import.meta.url),
),
},
},
}
return config
})