-
Notifications
You must be signed in to change notification settings - Fork 12
/
vite-runtime.config.ts
49 lines (48 loc) · 1.3 KB
/
vite-runtime.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
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'
import { resolve } from 'path'
import { viteStaticCopy } from 'vite-plugin-static-copy'
export default defineConfig({
envPrefix: 'SPLOOT_',
server: {
port: 3001,
strictPort: true,
},
assetsInclude: ['**/*.py', '**/*.whl'],
build: {
outDir: 'dist-runtime',
rollupOptions: {
input: {
main: resolve(__dirname, 'splootframepythonclient.html'),
streamlit: resolve(__dirname, 'splootstreamlitpythonclient.html'),
},
output: {
assetFileNames: 'assets/[name].[hash][extname]',
},
},
},
worker: {
rollupOptions: {
output: {
assetFileNames: 'assets/[name].[hash][extname]',
},
},
},
plugins: [
viteStaticCopy({
targets: [{ src: resolve(__dirname, 'node_modules', 'structured-pyright', 'dist', 'static'), dest: '' }],
}),
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', 'same-site')
next()
})
},
},
],
})