-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathvite.config.prod.js
More file actions
36 lines (34 loc) · 997 Bytes
/
Copy pathvite.config.prod.js
File metadata and controls
36 lines (34 loc) · 997 Bytes
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
import { fileURLToPath } from "node:url";
import path from "path";
import vue from "@vitejs/plugin-vue";
import { defineConfig, loadEnv } from "vite";
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }) => {
const env = loadEnv(mode, process.cwd());
// console.log("env", env, mode, command, URL);
return {
mode: "production",
plugins: [vue()],
resolve: {
alias: [
{
// '@': fileURLToPath(new URL('./src', import.meta.url)),
// '@': path.resolve(__dirname, './src'),
"@": path.resolve(path.dirname(fileURLToPath(import.meta.url)), "src"),
},
{
find: "vue",
replacement: "vue/dist/vue.esm-bundler.js", // 模块路径的替换, vue模块全部替换成vue.esm-bundler
},
],
},
esbuild: {
drop: command === "build" ? ["console", "debugger"] : [],
},
server: {
host: "0.0.0.0",
https: false,
port: 5174,
},
};
});