-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.js
61 lines (59 loc) · 1.36 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
61
// vite.config.js
import { sveltekit } from '@sveltejs/kit/vite';
import { ssp } from 'sveltekit-search-params/plugin';
import nodePolyfills from 'rollup-plugin-node-polyfills';
import inject from '@rollup/plugin-inject';
/** @type {import('vite').UserConfig} */
const config = {
plugins: [ssp(), sveltekit()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
},
resolve: {
alias: {
stream: 'rollup-plugin-node-polyfills/polyfills/stream',
events: 'rollup-plugin-node-polyfills/polyfills/events',
assert: 'assert',
crypto: 'crypto-browserify',
util: 'util/'
}
},
define: {
'process.env': process.env ?? {}
},
build: {
target: 'esnext',
rollupOptions: {
plugins: [
nodePolyfills({ crypto: true }),
inject({ modules: { Buffer: ['buffer', 'Buffer'] } })
]
}
},
optimizeDeps: {
include: ['svelte-pdf'],
esbuildOptions: {
define: {
global: 'globalThis'
}
// plugins: [
// NodeGlobalsPolyfillPlugin({ buffer: true }),
// ],
}
},
// optimizeDeps: {
// include: ['@project-serum/anchor', '@solana/web3.js', 'buffer'],
// // ... use the same implementation from the SvelteKit ui
// },
// define: {
// 'process.env': {}
// },
server: {
fs: {
// https://vitejs.dev/config/server-options.html#server-fs-allow
// allows importing readme for About page
allow: ['..']
}
}
};
export default config;