53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
import { fileURLToPath, URL } from "node:url";
|
|
|
|
import vue from "@vitejs/plugin-vue";
|
|
import { resolve } from "path";
|
|
import { defineConfig } from "vite";
|
|
|
|
import AutoImport from "unplugin-auto-import/vite";
|
|
import { NaiveUiResolver } from "unplugin-vue-components/resolvers";
|
|
import Components from "unplugin-vue-components/vite";
|
|
import svgLoader from "vite-svg-loader";
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
svgLoader(),
|
|
AutoImport({
|
|
include: [/\.[tj]sx?$/, /\.vue$/, /\.vue\?vue/, /\.md$/],
|
|
imports: ["vue", "pinia", "vue-router"],
|
|
dirs: ['./src/api/art'],
|
|
resolvers: [NaiveUiResolver()],
|
|
|
|
}),
|
|
Components({
|
|
resolvers: [NaiveUiResolver()],
|
|
}),
|
|
],
|
|
esbuild: {
|
|
pure: ['console.log'], // 删除 console.log
|
|
drop: ['debugger'], // 删除 debugger
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
},
|
|
},
|
|
base: "/blog/",
|
|
css: {
|
|
preprocessorOptions: {
|
|
less: {
|
|
additionalData: '@import "colorofchina/color.less";',
|
|
modifyVars: {
|
|
hack: `true; @import (reference) "${resolve("src/assets/style/index.less")}";`,
|
|
},
|
|
javascriptEnabled: true,
|
|
},
|
|
},
|
|
},
|
|
compilerOptions: {
|
|
allowJs: true,
|
|
},
|
|
});
|