-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathvite.config.js
64 lines (60 loc) · 1.38 KB
/
vite.config.js
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
60
61
62
63
64
import { defineConfig } from "vite";
import pkg from "./package.json";
import path from "path";
import createSvgSpritePlugin from "vite-plugin-svg-sprite";
import { createMpaPlugin, createPages } from "vite-plugin-virtual-mpa";
const base = "/";
const pages = createPages([
{
name: "landing",
filename: "index.html",
entry: "/src/pages/landing/entry.js",
data: {
title: "Landing page",
description: "Landing",
},
},
{
name: "admin",
filename: "admin.html",
entry: "/src/pages/admin/entry.js",
data: {
title: "Admin",
description: "Admin Area",
},
},
]);
export default defineConfig(({ command, mode, ssrBuild }) => {
return {
base,
build: { modulePreload: { polyfill: false } },
server: {
open: true,
proxy: {
"/api/v1/": {
target: "http://localhost:9000",
changeOrigin: true,
},
},
},
define: {
NODE_ENV: JSON.stringify(
command === "serve" ? "development" : "production"
),
__VERSION__: JSON.stringify(pkg.version),
},
plugins: [
createSvgSpritePlugin({
symbolId: "icon-[name]-[hash]",
}),
createMpaPlugin({
template: "src/pages/template.html",
pages,
htmlMinify: true,
}),
],
resolve: {
alias: { "@": path.resolve(__dirname, "src") },
},
};
});