-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
45 lines (39 loc) · 1.05 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
41
42
43
44
45
import { sveltekit } from '@sveltejs/kit/vite';
import { resolve } from 'path';
import { generateCanisterAliases, getEnvironmentPath } from './config/dfx.config.cjs';
const isDevelopment = process.env.DFX_NETWORK !== 'ic' && process.env.DFX_NETWORK !== 'staging';
const isProduction = process.env.DFX_NETWORK === 'ic';
const isStaging = process.env.DFX_NETWORK === 'staging';
const aliases = generateCanisterAliases();
const environment = getEnvironmentPath(isDevelopment, isStaging);
const envOptions = {
isDevelopment,
isProduction,
aliases,
environment
};
const config = {
build: {
brotliSize: true,
cssCodeSplit: true,
minify: isProduction
},
server: {
fs: {
allow: ['config', '.dfx/local']
}
},
resolve: {
alias: {
...envOptions.aliases,
$components_ref: resolve('./src/ui/components/'),
$modals_ref: resolve('./src/ui/modals/'),
$stores_ref: resolve('./src/ui/store/'),
$utils: resolve('./src/ui/utils'),
environment: envOptions.environment
},
dedupe: ['svelte']
},
plugins: [sveltekit()]
};
export default config;