-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathvite.config.js
48 lines (48 loc) · 1.1 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
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import ElementPlus from "unplugin-element-plus/vite";
const { resolve } = require("path");
/**
* @type {import('vite').UserConfig}
*/
export default defineConfig(({ command, mode }) => {
let vueI18n = {};
if (command === "serve") {
vueI18n["vue-i18n"] = "vue-i18n/dist/vue-i18n.cjs.js"; //解决dev运行警告You are running the esm-bundler build of vue-i18n.
}
return {
plugins: [
vue(),
ElementPlus({
useSource: true,
}),
],
resolve: {
alias: {
"~/": `${resolve(__dirname, "src")}/`,
...vueI18n,
},
},
// base: "./",
server: {
host: "127.0.0.1",
port: 8086,
open: true,
// 反向代理
proxy: {
"/api": {
target: "http://127.0.0.1:80/",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@use "~/styles/element/index.scss" as *;`,
},
},
},
};
});