-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.ts
65 lines (60 loc) · 1.68 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
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'
const EMPTY_PATH = require.resolve(
'rollup-plugin-node-polyfills/polyfills/empty.js',
)
// https://vitejs.dev/config/
export default defineConfig({
build: {
target: 'esnext',
},
define: { global: 'globalThis' },
optimizeDeps: {
esbuildOptions: {
target: 'esnext',
plugins: [
NodeGlobalsPolyfillPlugin({
process: true,
buffer: true,
}),
]
},
},
plugins: [vue(), vueJsx()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
bufferutil: EMPTY_PATH,
child_process: EMPTY_PATH,
crypto: EMPTY_PATH,
dns: EMPTY_PATH,
events: require.resolve("events/"),
eventsource: EMPTY_PATH,
fs: EMPTY_PATH,
http: EMPTY_PATH,
https: EMPTY_PATH,
libpq: EMPTY_PATH,
module: EMPTY_PATH,
net: "./empty.cjs",
// net: require.resolve("./empty.cjs"),
// net: require.resolve('websockets'),
os: EMPTY_PATH,
"parse-database-url": EMPTY_PATH,
path: EMPTY_PATH,
pg: EMPTY_PATH,
"pg-format": EMPTY_PATH,
"pg-native": EMPTY_PATH,
solc: EMPTY_PATH,
tls: "./empty.cjs",
// tls: require.resolve("./empty.cjs"),
// tls: require.resolve('websockets'),
url: EMPTY_PATH,
zlib: EMPTY_PATH,
util: require.resolve('rollup-plugin-node-polyfills/polyfills/util.js'),
stream: require.resolve('stream-browserify'),
},
},
})