-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
34 lines (28 loc) · 903 Bytes
/
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
import { svelte } from '@sveltejs/vite-plugin-svelte';
import { defineConfig } from 'vite';
import { devServer } from './config.js';
import routify from '@roxi/routify/vite-plugin';
import restApi from './src_api';
const {PORT, NODE_ENV} = process.env;
const dev = NODE_ENV !== 'production';
for (let ENV_VAR in globalThis) {
if (process.env[ENV_VAR]) {
globalThis[ENV_VAR] = process.env[ENV_VAR];
}
}
globalThis.SESS_API_URL || (globalThis.SESS_API_URL = (dev ? '/api' : globalThis.API_URL) + '/auth/session')
export default defineConfig({
base: globalThis.BASE_URL||'/',
plugins: [
routify({
routesDir: {default: 'src_front/pages'},
devHelper: dev,
}),
svelte(),
dev && restApi()
],
resolve: {
alias: {'~': `${__dirname}/src_front`}
},
server: {...devServer, port: PORT||devServer.port},
})