-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
79 lines (77 loc) · 2.68 KB
/
vite.config.ts
File metadata and controls
79 lines (77 loc) · 2.68 KB
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
73
74
75
76
77
78
79
import react from '@vitejs/plugin-react';
import path from 'path';
import polyfillNode from 'rollup-plugin-polyfill-node';
import { defineConfig } from 'vite';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
import svgr from 'vite-plugin-svgr';
export default defineConfig(({ mode }) => {
const env = process.env.NODE_ENV || 'development';
const isProduction = env === 'production';
return {
base: './',
plugins: [
nodePolyfills({
protocolImports: true,
}),
react(),
svgr({
svgrOptions: {
icon: true,
},
}),
],
resolve: {
alias: {
api: path.resolve(__dirname, 'src/api'),
app: path.resolve(__dirname, 'src/app'),
components: path.resolve(__dirname, 'src/components'),
helpers: path.resolve(__dirname, 'src/helpers'),
navigation: path.resolve(__dirname, 'src/navigation'),
providers: path.resolve(__dirname, 'src/providers'),
views: path.resolve(__dirname, 'src/views'),
wallet: path.resolve(__dirname, 'src/wallet'),
wrappers: path.resolve(__dirname, 'src/wrappers'),
'asn1.js': path.resolve(__dirname, 'node_modules/asn1.js'),
elliptic: path.resolve(__dirname, 'node_modules/elliptic'),
qrcode$: path.resolve(__dirname, 'src/helpers/qrcode-alias.js'),
process: 'vite-plugin-node-polyfills/polyfills/process-es6',
buffer: 'vite-plugin-node-polyfills/polyfills/buffer',
crypto: 'vite-plugin-node-polyfills/polyfills/crypto',
stream: 'vite-plugin-node-polyfills/polyfills/stream',
util: 'vite-plugin-node-polyfills/polyfills/util',
path: 'vite-plugin-node-polyfills/polyfills/path',
events: 'vite-plugin-node-polyfills/polyfills/events',
timers: 'vite-plugin-node-polyfills/polyfills/timers',
http: 'vite-plugin-node-polyfills/polyfills/http',
https: 'vite-plugin-node-polyfills/polyfills/https',
os: 'vite-plugin-node-polyfills/polyfills/os',
assert: 'vite-plugin-node-polyfills/polyfills/assert',
zlib: 'vite-plugin-node-polyfills/polyfills/zlib',
constants: 'vite-plugin-node-polyfills/polyfills/constants',
url: 'vite-plugin-node-polyfills/polyfills/url',
},
},
optimizeDeps: {
include: ['buffer', 'process', 'crypto', 'stream', 'util'],
},
define: {
'process.env.REACT_APP_SUPABASE_URL': JSON.stringify(process.env.REACT_APP_SUPABASE_URL || ''),
'process.env.REACT_APP_SUPABASE_ANON_KEY': JSON.stringify(process.env.REACT_APP_SUPABASE_ANON_KEY || ''),
'process.browser': JSON.stringify(true),
},
build: {
sourcemap: false,
outDir: path.resolve(__dirname, 'dist'),
emptyOutDir: true,
rollupOptions: {
plugins: [polyfillNode()],
},
},
server: {
open: false,
strictPort: true,
hmr: true,
port: 3000,
},
};
});