You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
904 B
39 lines
904 B
import { defineConfig, loadEnv } from "vite";
|
|
import uni from "@dcloudio/vite-plugin-uni";
|
|
import pkg from "./package.json";
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, __dirname);
|
|
// console.log(env);
|
|
return {
|
|
build: {
|
|
minify: "terser",
|
|
terserOptions: {
|
|
compress: {
|
|
// 移除console
|
|
drop_console: false,
|
|
drop_debugger: true,
|
|
},
|
|
},
|
|
},
|
|
define: {
|
|
__APP_INFO__: JSON.stringify({
|
|
pkg,
|
|
buildTimestamp: Date.now(),
|
|
}),
|
|
},
|
|
plugins: [uni()],
|
|
server: {
|
|
port: Number.parseInt(env.VITE_APP_PORT, 10),
|
|
proxy: {
|
|
[env.VITE_APP_PROXY_PREFIX]: {
|
|
changeOrigin: true,
|
|
target: env.VITE_APP_BASE_URL,
|
|
rewrite: (path) =>
|
|
path.replace(new RegExp("^" + env.VITE_APP_PROXY_PREFIX), ""),
|
|
},
|
|
},
|
|
},
|
|
};
|
|
});
|