-
Notifications
You must be signed in to change notification settings - Fork 14
/
svelte.config.js
54 lines (49 loc) · 1 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
import fs from 'fs'
import adapter from '@sveltejs/adapter-static'
const pkg = JSON.parse(
fs.readFileSync(new URL('./package.json', import.meta.url), 'utf8')
)
const CONTENT = {
NAME: pkg.name,
VERSION_PACKAGE: pkg.version,
HOMEPAGE: pkg.homepage,
TS: new Date().toLocaleString(),
}
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: [
{
script: ({ content }) => {
let code = content
Object.entries(CONTENT).map(([key, value]) => {
code = code.replace(
new RegExp('process.env.' + key, 'g'),
JSON.stringify(value)
)
})
return {
code,
}
},
},
],
kit: {
adapter: adapter(),
target: '#svelte',
files: {
assets: 'demo/static',
lib: 'src',
routes: 'demo/routes',
template: 'demo/app.html',
},
package: {},
vite: {
server: {
fs: {
allow: ['..'],
},
},
},
},
}
export default config