代码拉取完成,页面将自动刷新
import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import VueAutoImport from "unplugin-auto-import/vite";
export default defineConfig({
envPrefix: "HY_", //为自定义开头名
plugins: [
uni(),
VueAutoImport({
// 引入的文件类型
include: [
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
/\.vue$/,
/\.vue\?vue/, // .vue
],
// 全局导入注册
imports: [
// 预设引入npm包
"vue",
"uni-app",
"vue-router",
],
dirs: ["hooks"],
dts: "auto-import.d.ts",
eslintrc: {
enabled: false, // Default `false`
filepath: "./.eslintrc-auto-import.json", // Default `./.eslintrc-auto-import.json`
globalsPropValue: true, // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
},
}),
],
build: {
// sourcemap: process.env.NODE_ENV === 'development',
// minify: 'terser',
// // 发布时删除 console
// terserOptions: {
// compress: {
// drop_console: true,
// },
// },
},
// resolve: {
// alias: {
// '@': fileURLToPath(new URL('./src', import.meta.url))
// }
// },
server: {
host: "0.0.0.0",
port: 8088, //启动端口
proxy: {
"/api": {
target: "http://192.168.10.102:8080",
changeOrigin: true,
//类比与webpack里面的pathRewrite
rewrite: path => path.replace(/^\/api/, ""),
},
"/formalapi": {
target: "https://hongcai365.com",
changeOrigin: true,
//类比与webpack里面的pathRewrite
rewrite: path => path.replace(/^\/formalapi/, ""),
},
},
},
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。