forked from helius-labs/xray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
60 lines (59 loc) · 1.63 KB
/
vite.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
56
57
58
59
60
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
import { NodeGlobalsPolyfillPlugin } from "@esbuild-plugins/node-globals-polyfill";
import { NodeModulesPolyfillPlugin } from "@esbuild-plugins/node-modules-polyfill";
import pkg from "./package.json";
import path from "path";
export default defineConfig(({ mode }) => ({
build: {
target: "es2020",
rollupOptions: {
external: ['crypto']
}
},
define: {
APP_NAME: JSON.stringify(pkg.name),
APP_VERSION: JSON.stringify(pkg.version),
"process.env.NODE_DEBUG": false,
'global.crypto': 'crypto',
'global.Buffer': 'Buffer'
},
optimizeDeps: {
esbuildOptions: {
define: {
global: 'globalThis'
},
plugins: [
NodeGlobalsPolyfillPlugin({
buffer: true,
process: true,
crypto: true
})
],
target: "es2020",
},
include: ['buffer']
},
plugins: [
sveltekit(),
NodeModulesPolyfillPlugin(),
NodeGlobalsPolyfillPlugin({
buffer: true,
process: true,
crypto: true
})
],
resolve: {
alias: {
$lib: path.resolve("./src/lib"),
crypto: 'crypto-browserify',
stream: 'stream-browserify',
assert: 'assert',
http: 'stream-http',
https: 'https-browserify',
os: 'os-browserify',
url: 'url',
buffer: 'buffer'
}
}
}));