-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
50 lines (48 loc) · 1.17 KB
/
vite.config.ts
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 { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import pluginRewriteAll from 'vite-plugin-rewrite-all';
const moduleExclude = (match) => {
const m = (id) => id.indexOf(match) > -1;
return {
name: `exclude-${match}`,
resolveId(id) {
if (m(id)) return id;
},
load(id) {
if (m(id)) return `export default {}`;
},
};
};
// https://vitejs.dev/config/
export default defineConfig({
optimizeDeps: {
include: [
'gun',
'gun/gun',
'gun/sea',
'gun/sea.js',
'gun/lib/then',
'gun/lib/webrtc',
'gun/lib/radix',
'gun/lib/radisk',
'gun/lib/store',
'gun/lib/rindexed',
],
},
plugins: [
pluginRewriteAll(),
react(),
{
name: 'configure-response-headers',
configureServer: (server) => {
server.middlewares.use((_req, res, next) => {
res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp');
res.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
res.setHeader('Cross-Origin-Resource-Policy', 'cross-origin');
next();
});
},
},
moduleExclude('text-encoding'),
],
});