-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
41 lines (36 loc) · 1.1 KB
/
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
39
40
41
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// in fact using this does nothing
// it applies to local dev server only
// and emitting this wil also work ok
// fails in production only
// https://stackoverflow.com/questions/72755269/set-crossoriginisolated-svelte-and-sveltekit
const crossOriginIsolation = () => ({
name: 'configure-server',
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();
});
}
});
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
crossOriginIsolation()
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
build: { target: "es2022" },
optimizeDeps: {
esbuildOptions: { target: "es2022", supported: { bigint: true } },
},
})