-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
38 lines (35 loc) · 917 Bytes
/
vite.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
import { sveltekit } from '@sveltejs/kit/vite';
import unoCSS from 'unocss/vite'
import extractorSvelte from '@unocss/extractor-svelte'
/** @type {import('vite').Plugin} */
const viteServerConfig = {
name: 'add headers',
configureServer: (server) => {
server.middlewares.use((req, res, next) => {
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Methods", "GET");
res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
next();
});
}
};
/** @type {import('vite').UserConfig} */
const config = {
plugins: [
unoCSS({
extractors: [
extractorSvelte(),
],
}),
sveltekit(),
viteServerConfig
],
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
},
worker: {
format: 'es'
},
};
export default config;