-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsvelte.config.js
More file actions
50 lines (45 loc) · 1.05 KB
/
Copy pathsvelte.config.js
File metadata and controls
50 lines (45 loc) · 1.05 KB
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
import cloudflareAdapter from '@sveltejs/adapter-cloudflare';
import nodeAdapter from '@sveltejs/adapter-node';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
const adapter =
process.env.ENVIRONMENT === 'ci'
? nodeAdapter()
: cloudflareAdapter({
// See below for an explanation of these options
routes: {
include: ['/*'],
exclude: ['<all>']
},
platformProxy: {
configPath: 'wrangler.jsonc',
environment: process.env.ENVIRONMENT,
experimentalJsonConfig: false,
persist: false
}
});
const csp = {
csp: {
directives: {
'script-src': ['self'],
'frame-src': ['none']
}
}
};
const csrf = { csrf: { checkOrigin: true } };
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: [vitePreprocess({ typeScript: true })],
extensions: ['.svelte'],
kit: {
adapter,
...(process.env.NODE_ENV === 'development' ? {} : csp),
...(process.env.NODE_ENV === 'development' ? {} : csrf),
csrf: {
checkOrigin: true
},
env: {
dir: '.'
}
}
};
export default config;