增加自动导入插件,增加积分商城分包
This commit is contained in:
@@ -1,19 +1,37 @@
|
||||
import {
|
||||
defineConfig
|
||||
} from 'vite';
|
||||
import uni from '@dcloudio/vite-plugin-uni';
|
||||
// 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
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [uni()],
|
||||
server: {
|
||||
hmr: true,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://192.168.1.42',
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/api/, ''),
|
||||
secure: false
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
module.exports = defineConfig({
|
||||
plugins: [
|
||||
uni(),
|
||||
AutoImport({
|
||||
include: [
|
||||
/\.js$/,
|
||||
/\.vue$/, /\.vue\?vue/
|
||||
],
|
||||
imports: [
|
||||
"vue",
|
||||
{
|
||||
"@dcloudio/uni-app": [
|
||||
"onLoad", "onShow", "onHide", "onUnload",
|
||||
"uni.request", "uni.navigateTo", "uni.showToast"
|
||||
]
|
||||
}
|
||||
],
|
||||
dts: "src/auto-imports.d.ts"
|
||||
}),
|
||||
],
|
||||
server: {
|
||||
hmr: true,
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: "http://192.168.1.42",
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ""),
|
||||
secure: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user