-
Notifications
You must be signed in to change notification settings - Fork 303
/
Copy pathvite.config.ts
72 lines (71 loc) · 2.38 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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import viteTsconfigPaths from 'vite-tsconfig-paths';
import svgr from 'vite-plugin-svgr';
import monacoEditorPlugin from 'vite-plugin-monaco-editor';
import topLevelAwait from 'vite-plugin-top-level-await';
import { resolve } from 'node:path';
import { visualizer } from 'rollup-plugin-visualizer';
import { splitVendorChunkPlugin } from 'vite';
// https://vitejs.dev/config/
export default defineConfig({
optimizeDeps: {
exclude: ['@ironclad/rivet-core', '@ironclad/trivet'],
},
resolve: {
preserveSymlinks: true,
alias: {
'@ironclad/rivet-core': resolve('../core/src/index.ts'),
'@ironclad/trivet': resolve('../trivet/src/index.ts'),
'node:child_process': resolve('./src/mocks/node-polyfills.ts'),
'node:process': resolve('./src/mocks/node-polyfills.ts'),
'child_process': resolve('./src/mocks/node-polyfills.ts'),
'process': resolve('./src/mocks/node-polyfills.ts'),
'fs': resolve('./src/mocks/node-polyfills.ts'),
'path': resolve('./src/mocks/node-polyfills.ts'),
'os': resolve('./src/mocks/node-polyfills.ts'),
'stream': resolve('./src/mocks/node-polyfills.ts'),
'util': resolve('./src/mocks/node-polyfills.ts'),
'events': resolve('./src/mocks/node-polyfills.ts'),
'buffer': resolve('./src/mocks/node-polyfills.ts'),
'crypto': resolve('./src/mocks/node-polyfills.ts'),
'querystring': resolve('./src/mocks/node-polyfills.ts'),
'url': resolve('./src/mocks/node-polyfills.ts'),
'http': resolve('./src/mocks/node-polyfills.ts'),
'https': resolve('./src/mocks/node-polyfills.ts'),
'net': resolve('./src/mocks/node-polyfills.ts'),
'tls': resolve('./src/mocks/node-polyfills.ts'),
'assert': resolve('./src/mocks/node-polyfills.ts'),
},
},
build: {
chunkSizeWarningLimit: 10000,
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes('gpt-tokenizer')) {
return 'gpt-tokenizer';
}
},
},
plugins: [visualizer()],
},
},
define: {
'process.env': {},
'global': {},
},
plugins: [
react(),
viteTsconfigPaths(),
svgr({
svgrOptions: {
icon: true,
},
}),
// Bad ESM
(monacoEditorPlugin as any).default({}),
topLevelAwait(),
splitVendorChunkPlugin(),
],
});