99 lines
1.7 KiB
TypeScript
99 lines
1.7 KiB
TypeScript
import { resolve } from "path";
|
|
import { Alias, defineConfig } from "vite";
|
|
import vue from "@vitejs/plugin-vue";
|
|
import VueSetupExtend from "vite-plugin-vue-setup-extend";
|
|
import AutoImport from "unplugin-auto-import/vite";
|
|
import Components from "unplugin-vue-components/vite";
|
|
import { TDesignResolver } from "unplugin-vue-components/resolvers";
|
|
import dts from "vite-plugin-dts";
|
|
|
|
const alias: Alias[] = [
|
|
{
|
|
find: "@",
|
|
replacement: resolve(__dirname, "./examples")
|
|
},
|
|
{
|
|
find: "~",
|
|
replacement: resolve(__dirname, "./src")
|
|
},
|
|
{
|
|
find: "*",
|
|
replacement: resolve("")
|
|
},
|
|
{
|
|
find: /^timi-tdesign-pc(\/(es|lib))?$/,
|
|
replacement: resolve(__dirname, "./src/index.ts")
|
|
}
|
|
];
|
|
|
|
export default defineConfig({
|
|
server: {
|
|
port: 3004,
|
|
host: true
|
|
},
|
|
resolve: {
|
|
alias
|
|
},
|
|
build: {
|
|
outDir: "dist",
|
|
lib: {
|
|
entry: resolve(__dirname, "./src/index.ts"),
|
|
name: "TimiTDesignPC",
|
|
fileName: "timi-tdesign-pc"
|
|
},
|
|
rollupOptions: {
|
|
external: [
|
|
"vue",
|
|
"timi-web",
|
|
"tdesign-vue-next"
|
|
],
|
|
output: {
|
|
globals: {
|
|
vue: "Vue"
|
|
}
|
|
}
|
|
},
|
|
minify: "terser",
|
|
terserOptions: {
|
|
compress: {
|
|
// eslint-disable-next-line camelcase
|
|
drop_console: false,
|
|
// eslint-disable-next-line camelcase
|
|
drop_debugger: false
|
|
}
|
|
}
|
|
},
|
|
plugins: [
|
|
vue({
|
|
include: [/\.vue$/, /\.md$/]
|
|
}),
|
|
VueSetupExtend(),
|
|
dts(),
|
|
AutoImport({
|
|
imports: [
|
|
"vue"
|
|
],
|
|
dts: "examples/auto-imports.d.ts",
|
|
eslintrc: {
|
|
enabled: true,
|
|
globalsPropValue: true
|
|
},
|
|
resolvers: [
|
|
TDesignResolver({
|
|
library: "vue-next"
|
|
})
|
|
]
|
|
}),
|
|
Components({
|
|
dirs: [
|
|
"src/components"
|
|
],
|
|
resolvers: [
|
|
TDesignResolver({
|
|
library: "vue-next"
|
|
})
|
|
]
|
|
})
|
|
]
|
|
});
|