-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
52 lines (46 loc) · 1.22 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
import { defineConfig, PluginOption } from "vite";
import { svelte } from "@sveltejs/vite-plugin-svelte"; // BOLT_SVELTE_ONLY
import sveltePreprocess from "svelte-preprocess"; // BOLT_SVELTE_ONLY
import react from "@vitejs/plugin-react"; // BOLT_REACT_ONLY
import vue from "@vitejs/plugin-vue"; // BOLT_VUE_ONLY
import {
expressPlugin,
expressPluginInit,
runAction,
} from "vite-express-plugin";
import mkcert from "vite-plugin-mkcert";
import { config } from "./express.config";
const action = process.env.ACTION;
const mode = process.env.MODE || "";
if (action) runAction(config, action);
expressPluginInit(mode);
export default defineConfig({
define: {
"process.env.HMR_PORT": JSON.stringify(config.hmrPort),
},
plugins: [
react(), // BOLT_REACT_ONLY
vue(), // BOLT_VUE_ONLY
svelte({ preprocess: sveltePreprocess({ typescript: true }) }), // BOLT_SVELTE_ONLY
//@ts-ignore
expressPlugin(config, mode),
mkcert(),
],
base: "./",
build: {
outDir: ".tmp",
emptyOutDir: false,
},
css: {
preprocessorOptions: {
scss: {
quietDeps: true,
api: "modern",
silenceDeprecations: ["legacy-js-api"],
},
},
},
server: {
port: config.hmrPort,
},
});