1 Star 1 Fork 0

h_h123/vue3Admin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
vite.config.js 1.75 KB
一键复制 编辑 原始数据 按行查看 历史
h_h123 提交于 2024-02-08 13:41 . port => new
import { defineConfig, loadEnv } from "vite";
import { resolve } from "path";
import vue from "@vitejs/plugin-vue";
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
export default defineConfig(({ mode }) => {
let env = loadEnv(mode, process.cwd());
return {
base: env.VITE_USER_NODE_ENV === 'production' ? './' : '/',
server: {
hmr: true,
host: "0.0.0.0",
port: "9999",
open: true,
https: false,
proxy: {
[env.VITE_APP_BASE_API]: {
target: env.VITE_SERVE,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
},
}
},
resolve: {
alias: {
"@": resolve(__dirname, "./src"),
},
// alias: {
// "@": path.resolve("./src"),
// },
},
css: {
preprocessorOptions: {
scss: {
// javascriptEnabled: true,
additionalData: '@import "@/style/root.scss";',
},
},
},
// 分包
build: {
rollupOptions: {
manualChunks(id) {
if (id.includes("node_modules")) {
return "vendor";
}
},
},
},
plugins: [
Components({
resolvers: [ElementPlusResolver()],
}),
vue(),
AutoImport({
include: [/\.vue$/, /\.vue\?vue/],
imports: [
"vue",
"vue-router",
"pinia",
{
"@/utils/enums.js": ["ENUMS"],
"element-plus": ["ElMessage"],
"@/hooks/use/index.js": [["default", "_hook"]],
},
],
eslintrc: {
enabled: false,
},
}),
],
}
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/huangjunhua/vue3-admin.git
git@gitee.com:huangjunhua/vue3-admin.git
huangjunhua
vue3-admin
vue3Admin
master

搜索帮助