-
Notifications
You must be signed in to change notification settings - Fork 0
/
svelte.config.js
41 lines (36 loc) · 960 Bytes
/
svelte.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
import adapterStatic from '@sveltejs/adapter-static';
import adapterAuto from '@sveltejs/adapter-auto';
import preprocess from 'svelte-preprocess';
import dotenv from "dotenv";
import path from 'path';
import { readFileSync } from 'fs';
dotenv.config()
const staticMode = process.env.STATIC === 'true';
const basePath = process.env.BASE_PATH || '';
/** @type {import('@sveltejs/kit').Config} */
const config = {
// https://github.com/sveltejs/svelte-preprocess
preprocess: preprocess(),
kit: {
prerender: {
default: true
},
adapter: staticMode ? adapterStatic() : adapterAuto(),
paths: {
base: staticMode ? basePath : '',
},
vite: {
envPrefix: "PUBLIC_",
define: {
pkg: JSON.parse(readFileSync(new URL('package.json', import.meta.url), 'utf8'))
},
resolve: {
alias: {
$components: path.resolve('./src/components'),
$constants: path.resolve('./src/constants'),
}
}
}
}
};
export default config;