代码拉取完成,页面将自动刷新
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,
},
}),
],
}
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。