-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathvite.config.js
More file actions
128 lines (123 loc) · 4.06 KB
/
vite.config.js
File metadata and controls
128 lines (123 loc) · 4.06 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import react from '@vitejs/plugin-react'
import dns from 'dns'
import dotenv from 'dotenv'
import { defineConfig } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import svgr from 'vite-plugin-svgr'
dotenv.config()
if (!process.env.MAPBOX_ACCESS_TOKEN) {
throw new Error(
`
__ __ _______ __ __ _______ _______ ______ _______ _______ _______
| | | || || | | | | || || _ | | || || |
| |_| || _ || | | | | ___|| _ || | || | ___|| _ ||_ _|
| || | | || |_| | | |___ | | | || |_||_ | | __ | | | | | |
|_ _|| |_| || | | ___|| |_| || __ || || || |_| | | |
| | | || | | | | || | | || |_| || | | |
|___| |_______||_______| |___| |_______||___| |_||_______||_______| |___|
_______ _______ __ __ _______ _______ __ __ ___ __ _ _______
| || || |_| || || || | | || | | | | || |
| _____|| _ || || ___||_ _|| |_| || | | |_| || ___|
| |_____ | | | || || |___ | | | || | | || | __
|_____ || |_| || || ___| | | | || | | _ || || |
_____| || || ||_|| || |___ | | | _ || | | | | || |_| |
|_______||_______||_| |_||_______| |___| |__| |__||___| |_| |__||_______|
👉 MAPBOX_ACCESS_TOKEN environment variable is not defined. Please set it in your .env file. 👈
`,
)
}
dns.setDefaultResultOrder('verbatim')
export default () => {
return defineConfig({
plugins: [react(), svgr(), nodePolyfills()],
test: {
environment: 'jsdom',
globals: true,
include: ['src/**/__tests__/**/*.{test,spec}.{js,jsx}'],
exclude: ['oldTests/**', 'cypress/**', '**/node_modules/**']
},
define: {
'import.meta.env.MAPBOX_ACCESS_TOKEN': JSON.stringify(
process.env.MAPBOX_ACCESS_TOKEN,
),
},
css: {
preprocessorOptions: {
scss: {
includePaths: ['./node_modules/@uswds/uswds/packages'],
},
},
},
server: {
watch: {
usePolling: true,
},
host: true,
port: '3000',
proxy: {
// Enter the endpoint that needs to be proxied, this is Vite's way of proxing
'/quarterly-data/graphs': {
// Quarterly graphs endpoint
target: process.env.DEV_URL,
changeOrigin: true,
secure: false,
},
'/v2/public/institutions': {
// Verifies user domain and associated institutions endpoint
target: process.env.DEV_URL,
changeOrigin: true,
secure: false,
},
'/hmda-auth/users': {
// Update LEIs associated with users account (Profile Page)
target: process.env.DEV_URL,
changeOrigin: true,
secure: false,
},
'/v2/reporting': {
// Modified LAR endpoint
target: process.env.DEV_URL,
changeOrigin: true,
secure: false,
},
'/v2/filing': {
// Fetch all filings
target: process.env.DEV_URL,
changeOrigin: true,
secure: false,
},
'/v2/admin/institutions': {
// HMDA Help endpoint
target: process.env.DEV_URL,
changeOrigin: true,
secure: false,
},
'/v2/admin/receipt/': {
// HMDA Help Submissions file download endpoint
target: process.env.DEV_URL,
changeOrigin: true,
secure: false,
},
'/v2/data-browser-api': {
// Data Browser API
target: process.env.DEV_URL,
changeOrigin: true,
secure: false,
},
'/v2/public/hmda/parse': {
// File Format Verification Tool API
target: process.env.DEV_URL,
changeOrigin: true,
secure: false,
},
},
},
optimizeDeps: {
esbuildOptions: {
loader: {
'.js': 'jsx',
},
},
},
})
}