85 lines
1.8 KiB
TypeScript
85 lines
1.8 KiB
TypeScript
import { fileURLToPath, URL } from "node:url";
|
||
import { defineConfig } from "vite";
|
||
import vue from "@vitejs/plugin-vue";
|
||
import AutoImport from "unplugin-auto-import/vite";
|
||
import Components from "unplugin-vue-components/vite";
|
||
import { TDesignResolver } from "unplugin-vue-components/resolvers";
|
||
|
||
export default defineConfig({
|
||
resolve: {
|
||
dedupe: ["vue", "pinia", "vue-router"],
|
||
alias: [
|
||
{
|
||
find: "@",
|
||
replacement: fileURLToPath(new URL("./src", import.meta.url))
|
||
}
|
||
]
|
||
},
|
||
plugins: [
|
||
vue(),
|
||
AutoImport({
|
||
imports: ["vue", "vue-router", "pinia"],
|
||
dts: "auto-imports.d.ts",
|
||
eslintrc: {
|
||
enabled: true,
|
||
filepath: "./.eslintrc-auto-import.json",
|
||
globalsPropValue: true
|
||
},
|
||
resolvers: [
|
||
TDesignResolver({
|
||
library: "mobile-vue"
|
||
})
|
||
]
|
||
}),
|
||
Components({
|
||
dirs: ["src/components", "src/layout"],
|
||
dts: "components.d.ts",
|
||
resolvers: [
|
||
TDesignResolver({
|
||
library: "mobile-vue"
|
||
}),
|
||
(name) => {
|
||
if (name === "CardContainer") {
|
||
return {
|
||
name: "CardContainer",
|
||
from: "timi-tdesign-mobile"
|
||
};
|
||
}
|
||
if (name === "CenterTips") {
|
||
return {
|
||
name: "CenterTips",
|
||
from: "timi-web"
|
||
};
|
||
}
|
||
}
|
||
]
|
||
})
|
||
],
|
||
css: {
|
||
preprocessorOptions: {
|
||
less: {
|
||
javascriptEnabled: true
|
||
}
|
||
}
|
||
},
|
||
server: {
|
||
port: 84,
|
||
allowedHosts: [
|
||
"gao.imyeyu.com"
|
||
],
|
||
/**
|
||
* 调试产物(截图、CDP 脚本、Chrome 的 user-data-dir)不能被监听:
|
||
* Chrome 运行时锁着里面的 SQLite,chokidar 一 watch 就 EBUSY 把 dev server 打挂。
|
||
* 默认的 .git / node_modules 需要显式保留,因为这里的 ignored 会覆盖默认值。
|
||
*/
|
||
watch: {
|
||
ignored: [
|
||
"**/.git/**",
|
||
"**/node_modules/**",
|
||
"**/.debug-*",
|
||
"**/.debug-*/**"
|
||
]
|
||
}
|
||
}
|
||
});
|