forked from ppoffice/hexo-theme-icarus
-
Notifications
You must be signed in to change notification settings - Fork 43
/
vite.config.ts
39 lines (37 loc) · 1.01 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
import { defineConfig } from "vite";
import { fileURLToPath } from "url";
import path from "path";
export default ({ mode }: { mode: string }) => {
const isProduction = mode === "production";
return defineConfig({
root: "./src",
base: isProduction ? "/themes/theme-icarus/assets/dist/" : "",
define: {
"process.env": process.env,
},
build: {
manifest: true,
minify: isProduction,
rollupOptions: {
input: path.resolve(__dirname, "src/main.ts"),
output: {
entryFileNames: "[name].js",
chunkFileNames: "[name].js",
assetFileNames: "[name][extname]",
manualChunks(id) {
if (id.includes("node_modules")) {
if (id.includes("katex")) {
return "katex";
}
}
},
},
},
outDir: fileURLToPath(new URL("./templates/assets/dist", import.meta.url)),
emptyOutDir: true,
},
server: {
origin: "http://localhost:5173",
},
});
};