-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathvite.config.ts
More file actions
89 lines (87 loc) · 2.35 KB
/
vite.config.ts
File metadata and controls
89 lines (87 loc) · 2.35 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
80
81
82
83
84
85
86
87
88
89
// SPDX-License-Identifier: Apache-2.0
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
// yarn add --dev @esbuild-plugins/node-modules-polyfill
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill'; // Temporarily disabled
// You don't need to add this to deps, it's included by @esbuild-plugins/node-modules-polyfill
import commonjs from '@rollup/plugin-commonjs';
import react from '@vitejs/plugin-react';
import tsconfigPaths from 'vite-tsconfig-paths';
import EnvironmentPlugin from 'vite-plugin-environment';
import pluginRewriteAll from 'vite-plugin-rewrite-all';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
export default {
plugins: [
react(),
EnvironmentPlugin('all'),
pluginRewriteAll(),
tsconfigPaths(),
nodePolyfills({
protocolImports: true,
globals: {
Buffer: true,
global: true,
process: true,
},
overrides: {
fs: 'memfs',
},
include: [
'buffer',
'process',
'util',
'stream',
'crypto',
'os',
'vm',
'path',
],
exclude: ['http', 'https', 'url', 'querystring', 'path', 'fs'],
}),
],
define: {
...(process.env.NODE_ENV === 'development' ? { global: 'globalThis' } : {}),
},
resolve: {
alias: {
winston: '/src/winston-mock.js',
'winston-daily-rotate-file': '/src/winston-mock.js',
'winston-transport': '/src/winston-mock.js',
},
dedupe: ['react', 'react-dom', '@emotion/react', '@emotion/styled'],
},
optimizeDeps: {
include: [
'@hashgraph/asset-tokenization-contracts',
'@hashgraph/asset-tokenization-sdk',
'@chakra-ui/react',
'@emotion/react',
'@emotion/styled',
'framer-motion',
],
exclude: ['winston', 'winston-daily-rotate-file', 'winston-transport'],
esbuildOptions: {
define: {
global: 'globalThis',
},
plugins: [
NodeGlobalsPolyfillPlugin({
process: true,
buffer: true,
}),
NodeModulesPolyfillPlugin(),
],
},
},
build: {
rollupOptions: {
plugins: [
commonjs({
include: ['**/packages/ats/contracts/**'],
}),
],
},
},
server: {
sourcemap: true, // Source maps are enabled for debugging in browser
},
};