forked from PanJiaChen/vue-admin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
60 lines (57 loc) · 1.39 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
60
import path from "path";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import ViteRequireContext from '@originjs/vite-plugin-require-context'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import { createHtmlPlugin } from "vite-plugin-html";
function resolve(dir) {
return path.join(__dirname, dir)
}
const defaultSettings = require("./src/settings.js");
const TITLE = defaultSettings.title || "vue Admin Template"; // page title
const BASE_URL = "/";
const PORT = Number(process.env.port) || Number(process.env.npm_config_port) || 9528; // dev port
// https://vitejs.dev/config/
export default defineConfig({
base: BASE_URL,
server: {
port: PORT,
open: true,
},
plugins: [
vue(),
ViteRequireContext(),
createSvgIconsPlugin({
// Specify the icon folder to be cached
iconDirs: [resolve("src/icons/svg")],
// Specify symbolId format
symbolId: "icon-[name]",
}),
createHtmlPlugin({
minify: false,
entry: "src/main.js",
inject: {
data: {
TITLE: TITLE,
BASE_URL: BASE_URL
},
},
}),
],
resolve: {
alias: {
"@": resolve("src"),
"~@": resolve("src"),
},
},
build: {
rollupOptions: {
output: {
manualChunks: {
vue: ["vue"],
"element-plus": ["element-plus"],
},
},
},
},
});