-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathvite.config.js
63 lines (61 loc) · 1.68 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
62
63
import { defineConfig } from 'vite';
import inject from '@rollup/plugin-inject';
import nodeStdlibBrowser from 'node-stdlib-browser';
import react from '@vitejs/plugin-react';
import viteTsconfigPaths from 'vite-tsconfig-paths';
import svgrPlugin from 'vite-plugin-svgr';
import { viteStaticCopy } from 'vite-plugin-static-copy';
import path from 'path';
// Get require functionality in ESM
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
viteTsconfigPaths(),
svgrPlugin(),
viteStaticCopy({
targets: [
{
src: `${path.dirname(require.resolve('@aztec/sdk'))}/aztec-connect.wasm`,
dest: '',
},
{
src: `${path.dirname(require.resolve('@aztec/sdk'))}/web_worker.js`,
dest: '',
},
],
}),
{
...inject({
global: [require.resolve('node-stdlib-browser/helpers/esbuild/shim'), 'global'],
process: [require.resolve('node-stdlib-browser/helpers/esbuild/shim'), 'process'],
Buffer: [require.resolve('node-stdlib-browser/helpers/esbuild/shim'), 'Buffer'],
}),
enforce: 'post',
},
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
...nodeStdlibBrowser,
},
},
build: {
outDir: 'dest',
target: 'esnext', // Enable Big integer literals
commonjsOptions: {
transformMixedEsModules: true, // Enable @walletconnect/web3-provider which has some code in CommonJS
},
},
optimizeDeps: {
esbuildOptions: {
target: 'esnext',
},
},
server: {
port: 8080,
host: '0.0.0.0',
},
});