-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
vite.config.ts
59 lines (56 loc) · 1.64 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
51
52
53
54
55
56
57
58
59
// import react from "@vitejs/plugin-react";
import react from "@vitejs/plugin-react-swc";
import { visualizer } from "rollup-plugin-visualizer";
import tsconfigPaths from "vite-tsconfig-paths";
import { defineConfig } from "vite";
import copyMonaco from "./vite/copyAssets";
import alias from "@rollup/plugin-alias";
// https://vitejs.dev/config/
export default defineConfig({
server: {
port: 3000,
},
plugins: [
{
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");
next();
});
},
},
react(),
copyMonaco(),
tsconfigPaths(),
],
build: {
target: ["chrome95", "edge95", "esnext", "firefox95", "safari16"],
sourcemap: false,
rollupOptions: {
plugins: [
alias({
entries: [
{ find: "react", replacement: "preact/compat" },
{ find: "react-dom/test-utils", replacement: "preact/test-utils" },
{ find: "react-dom", replacement: "preact/compat" },
{ find: "react/jsx-runtime", replacement: "preact/jsx-runtime" },
],
}),
visualizer(),
],
output: {
sourcemap: false,
manualChunks: {
"rehype-parse": ["rehype-parse"],
"rehype-raw": ["rehype-raw"],
"react-markdown": ["react-markdown"],
"quicktype-core": ["quicktype-core"],
quicktype: ["quicktype"],
lodash: ["lodash"],
},
},
},
},
});