-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.mts
58 lines (52 loc) · 1.41 KB
/
vite.config.mts
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
import { defineConfig, type PluginOption } from "vite";
import { visualizer } from "rollup-plugin-visualizer";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import sveltePreprocess from "svelte-preprocess";
import { optimizeImports, optimizeCss } from "carbon-preprocess-svelte";
// import autoprefixer from "autoprefixer";
import path from "path";
export default defineConfig(({ mode }) => ({
server: {
proxy: {
// "/compile": {
// target: "http://localhost:8081",
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/compile/, ""),
// },
// "/lsp": {
// target: "ws://localhost:8082",
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/lsp/, ""),
// },
},
},
build: {
target: "es2019",
rollupOptions: {
strictDeprecations: true,
input: {
main: path.resolve(__dirname, "index.html"),
},
},
minify: mode === "production",
},
// css: {
// postCss: {
// plugins: [autoprefixer],
// },
// },
plugins: [
mode === "production" &&
(visualizer({
open: true,
gzipSize: true,
brotliSize: true,
}) as PluginOption),
svelte({
emitCss: false,
preprocess: [sveltePreprocess(), optimizeImports()],
}),
mode === "production" &&
(optimizeCss({ safelist: { greedy: [/xterm/] } }) as PluginOption),
],
}));