Files
cashier_wx/vite.config.js
2025-12-16 17:00:32 +08:00

43 lines
1014 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// vite.config.js正确的 CommonJS 配置)
const {
defineConfig
} = require("vite");
const uni = require("@dcloudio/vite-plugin-uni").default; // uni 插件需要 .default
const AutoImport = require("unplugin-auto-import/vite"); // 旧版本 AutoImport 直接导出函数,无需 .default
module.exports = defineConfig({
plugins: [
uni(),
AutoImport({
include: [/\.js$/, /\.vue$/, /\.vue\?vue/],
imports: [
"vue",
{
"@dcloudio/uni-app": [
"onLoad",
"onShow",
"onHide",
"onUnload",
"onReady",
"onReachBottom",
"onPageScroll",
"uni.request",
"uni.navigateTo",
"uni.showToast",
],
},
],
dts: "src/auto-imports.d.ts",
}),
],
server: {
proxy: {
'/api': {
// target: 'https://cashier.sxczgkj.com', // 目标服务器地址
target: 'http://192.168.1.42/', // 目标服务器地址
changeOrigin: true, // 是否更改请求源
rewrite: path => path.replace(/^\/api/, '')
},
},
},
});