forked from rvanasa/vite-react-motoko
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
40 lines (39 loc) · 1.12 KB
/
vite.config.ts
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 { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config';
import environment from 'vite-plugin-environment';
export default defineConfig({
plugins: [
sveltekit(),
// this is needed to surface the environment variables to your app
// https://vitejs.dev/guide/env-and-mode
// https://www.npmjs.com/package/vite-plugin-environment
environment('all', { prefix: 'CANISTER_' }),
environment('all', { prefix: 'DFX_' })
],
build: {
target: 'es2022'
},
optimizeDeps: {
// he global object varies between environments (like window in browsers, global in Node.js), leading to compatibility issues.
// By defining global as globalThis, developers unify access to the global scope, as globalThis is a standard and
// environment-agnostic way to refer to the global object/
esbuildOptions: {
define: {
global: 'globalThis'
}
}
},
server: {
port: 3000,
// this is needed to redirect api calls to the local replica locally
proxy: {
'/api': {
target: 'http://127.0.0.1:4943',
changeOrigin: true
}
}
},
test: {
include: ['tests/**/*.{test,spec}.{js,ts}']
}
});