forked from snuffyDev/Beatbump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
svelte.config.js
123 lines (112 loc) · 2.9 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// /* eslint-disable no-undef */
import node from '@sveltejs/adapter-node'
import adapter from '@sveltejs/adapter-cloudflare-workers'
// import worker from '@snuffydev/adapter-cloudflare-cache'
import autoprefixer from 'autoprefixer'
import cssnano from 'cssnano'
import path from 'path'
import sveltePreprocess from 'svelte-preprocess'
import dotenv from 'dotenv';
dotenv.config();
const rootDomain = process.env["VITE_DOMAIN"]; // or your server IP for dev
const originURL = process.env["VITE_SITE_URL"]; // or your server IP for dev
const check = process.env.NODE_ENV
const dev = check === 'development'
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: sveltePreprocess({
sass: false,
scss: {
includePaths: ['src'], prependData: '@import "src/global/stylesheet/base/_variables.scss";', renderSync: true
},
postcss: {
plugins: [cssnano({ preset: 'cssnano-preset-default' }), autoprefixer({})]
},
}),
kit: {
adapter: dev ? node() : adapter(),
csp: {
mode: 'nonce',
directives: {
'base-uri': ['self'],
'child-src': ['self'],
'connect-src': dev
? ['self', 'ws://localhost:*', 'ws://*', 'blob://*', '*']
: [
'self',
'ws://localhost:*',
'https://*.googlevideo.com',
'wss://*.peerjs.com',
'ws://*.peerjs.com'
],
// 'connect-src': ,
'img-src': [
'self',
'data:',
'blob:',
'https://*.ytimg.com',
'https://*.googleusercontent.com',
'https://*.ggpht.com',
'https://www.gstatic.com/'
],
'font-src': ['self', 'data:'],
'form-action': ['self'],
'frame-ancestors': ['self'],
'frame-src': ['self'],
'manifest-src': ['self'],
'media-src': [
'self',
'data:',
'blob://*',
'blob:*',
'ws://localhost:*',
'localhost:*',
'https://*.googlevideo.com'
],
'object-src': ['none'],
'style-src': ['self', 'unsafe-inline'],
'default-src': [
'self',
rootDomain,
`ws://${rootDomain}`,
'localhost:*',
'https://*.googlevideo.com/',
'https://static.cloudflareinsights.com'
],
'script-src': [
'self',
'localhost:*',
'sha256-jJRyFHbyYyWq0qnPRIobBCZON4vc+P5RXzYgJ5fHVTg=',
'report-sample',
'https://static.cloudflareinsights.com'
],
'worker-src': ['self']
}
},
files: {
assets: 'static',
lib: 'src/lib',
routes: 'src/routes',
serviceWorker: 'src/service-worker',
template: 'src/app.html',
hooks: 'src/hooks'
},
vite: {
resolve: {
alias: {
$stores: path.resolve('./src/lib/stores'),
$api: path.resolve('./src/routes/api'),
$components: path.resolve('./src/lib/components')
}
},
}
},
onwarn(warning, defaultHandler) {
// don't warn on <marquee> elements, cos they're cool
if (warning.code === "css-unused-selector")
return;
// handle all other warnings normally
defaultHandler(warning);
}
}
export default config