-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathsvelte.config.js
41 lines (35 loc) · 974 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 adapter from '@sveltejs/adapter-node'
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
const production = process.env.NODE_ENV === 'production'
const baseCsp = [
'self',
'https://www.gstatic.com/recaptcha/', // recaptcha
'https://accounts.google.com/gsi/', // sign-in w/google
'https://www.google.com/recaptcha/', // recapatcha
'https://fonts.gstatic.com/' // recaptcha fonts
]
if (!production) baseCsp.push('ws://localhost:3000')
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: vitePreprocess(),
kit: {
adapter: adapter({
out: 'build'
}),
csp: {
mode: 'auto',
directives: {
'default-src': [...baseCsp],
'script-src': ['unsafe-inline', ...baseCsp],
'img-src': ['data:', 'blob:', ...baseCsp],
'style-src': ['unsafe-inline', ...baseCsp],
'object-src': ['none'],
'base-uri': ['self']
}
},
files: {
serviceWorker: 'src/service-worker.ts'
}
}
}
export default config