-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.node.ts
48 lines (47 loc) · 1.12 KB
/
vite.config.node.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
/**
* vite node
*/
import { defineConfig } from 'vite';
import { VitePluginNode } from 'vite-plugin-node';
import { resolve } from 'path';
import compressServerCode from './plugins/compress-server-code';
import viteServerPort from './plugins/server-port';
// https://vitejs.dev/config/
export default defineConfig({
build: {
outDir: 'dist',
emptyOutDir: false,
rollupOptions: {
// 支持swagger
external: ['swagger-ui-dist', 'fs', 'path']
}
},
resolve: {
alias: {
'@': resolve(__dirname, 'server'),
'.prisma/client/index': resolve(__dirname, 'node_modules', '.prisma/client/index.js'),
'.prisma/client': resolve(__dirname, 'node_modules', '.prisma/client/index.js')
}
},
ssr: {
format: 'cjs'
},
server: {
/**
* 这里的port,既是开发时的端口,又是编译部署后的端口
*/
port: 9999,
host: '0.0.0.0',
open: true
},
plugins: [
...VitePluginNode({
adapter: 'koa',
appPath: './server/index.ts',
exportName: 'viteNodeApp',
tsCompiler: 'swc'
}),
compressServerCode(),
viteServerPort()
]
});