-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
42 lines (39 loc) · 1.06 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
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import EnvironmentPlugin from 'vite-plugin-environment'
export default defineConfig({
envDir: "../../",
plugins: [
react(),
// Spreads all the envars from .env prefixed with "CANISTER_" onto import.meta.env:
EnvironmentPlugin("all", { prefix: "CANISTER_", defineOn: "import.meta.env" }),
// Spreads all the envars from .env prefixed with "DFX_" onto import.meta.env:
EnvironmentPlugin("all", { prefix: "DFX_", defineOn: "import.meta.env" }),
],
build: {
outDir: "dist/",
emptyOutDir: true,
},
worker: {
format: 'es'
},
optimizeDeps: {
esbuildOptions: {
// Node.js global to browser globalThis.
// (Noted that it makes it possible for WebWorker to use imports.)
define: {
global: 'globalThis'
},
}
},
server: {
// Local IC replica proxy.
proxy: {
'/api': {
// Default port used.
target: 'http://127.0.0.1:4943',
changeOrigin: true
}
}
}
})