/
vite.config.server.ts
68 lines (58 loc) · 1.55 KB
/
vite.config.server.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
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
export default defineConfig({
cacheDir: '../../node_modules/.vite/activate',
server: {
port: 4200,
host: 'localhost',
},
preview: {
port: 4300,
host: 'localhost',
},
plugins: [
nxViteTsPaths(),
],
// Uncomment this if you are using workers.
// worker: {
// plugins: [
// viteTsConfigPaths({
// root: './',
// }),
// ],
// },
test: {
globals: true,
cache: {
dir: '../../node_modules/.vitest',
},
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
},
build: {
target: "modules",
commonjsOptions: {
transformMixedEsModules: true
},
rollupOptions: {
external: ["fsevents", "esbuild", "vite", "fs", "async_hooks", "node:fs", "querystring", "node:path", "node:url", "url", "path", "https", "http", "tls", "net", "zlib", "stream", "tty", "os", "crypto", "util"],
output: {
dynamicImportInCjs: true
}
},
copyPublicDir: false, // not copy public assets
minify: false
},
optimizeDeps: {
esbuildOptions: {
target: "modules"
},
force: true
},
ssr: {
// for production standalone deployment. bundle everything except the above external
// so that await import main.server.mjs no need any dpes under node_modules
noExternal: process.env["NX_TASK_TARGET_CONFIGURATION"] === "production" ? true : undefined
},
});