111 lines
1.8 KiB
TypeScript
111 lines
1.8 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 { prismjsPlugin } from "vite-plugin-prismjs";
|
|
import AutoImport from "unplugin-auto-import/vite";
|
|
import Components from "unplugin-vue-components/vite";
|
|
import dts from "vite-plugin-dts";
|
|
|
|
const alias: Alias[] = [
|
|
{
|
|
find: "@",
|
|
replacement: resolve(__dirname, "./examples")
|
|
},
|
|
{
|
|
find: "~",
|
|
replacement: resolve(__dirname, "./src")
|
|
},
|
|
{
|
|
find: "*",
|
|
replacement: resolve("")
|
|
},
|
|
{
|
|
find: /^timi-web(\/(es|lib))?$/,
|
|
replacement: resolve(__dirname, "./src/index.ts")
|
|
}
|
|
];
|
|
|
|
export default defineConfig({
|
|
server: {
|
|
port: 3003,
|
|
host: true
|
|
},
|
|
resolve: {
|
|
alias
|
|
},
|
|
build: {
|
|
outDir: "dist",
|
|
lib: {
|
|
entry: resolve(__dirname, "./src/index.ts"),
|
|
name: "TimiWeb",
|
|
fileName: "timi-web"
|
|
},
|
|
rollupOptions: {
|
|
external: [
|
|
"vue"
|
|
],
|
|
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(),
|
|
prismjsPlugin({
|
|
languages: [
|
|
"ini",
|
|
"php",
|
|
"sql",
|
|
"xml",
|
|
"css",
|
|
"less",
|
|
"html",
|
|
"json",
|
|
"yaml",
|
|
"java",
|
|
"nginx",
|
|
"javascript",
|
|
"typescript",
|
|
"apacheconf",
|
|
"properties"
|
|
],
|
|
plugins: [
|
|
"line-numbers"
|
|
],
|
|
theme: "default",
|
|
css: true
|
|
}),
|
|
AutoImport({
|
|
imports: [
|
|
"vue"
|
|
],
|
|
dts: "examples/auto-imports.d.ts",
|
|
eslintrc: {
|
|
enabled: true,
|
|
globalsPropValue: true
|
|
}
|
|
}),
|
|
Components({
|
|
dirs: [
|
|
"src/components"
|
|
]
|
|
})
|
|
]
|
|
});
|