All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 5m53s
69 lines
1.8 KiB
JavaScript
69 lines
1.8 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 vitePluginAutoI18n, { YoudaoTranslator } from 'vite-auto-i18n-plugin';
|
|
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()],
|
|
}),
|
|
// vitePluginAutoI18n({
|
|
// targetLangList: ['en'],
|
|
// translator: new YoudaoTranslator({
|
|
// appId: '203eecca921f0cc3',
|
|
// appKey: 't01UW7iRpCLJmyEy3SSWH2efp4htdkAg'
|
|
// })
|
|
// })
|
|
],
|
|
esbuild: {
|
|
pure: ['console.log'], // 删除 console.log
|
|
drop: ['debugger'], // 删除 debugger
|
|
},
|
|
define: {
|
|
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'true'
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
},
|
|
},
|
|
base: "/blog/",
|
|
server:{
|
|
host:'0.0.0.0',
|
|
port: 8080,
|
|
},
|
|
css: {
|
|
preprocessorOptions: {
|
|
less: {
|
|
additionalData: '@import "colorofchina/color.less";',
|
|
modifyVars: {
|
|
hack: `true; @import (reference) "${resolve("src/assets/style/index.less")}";`,
|
|
},
|
|
javascriptEnabled: true,
|
|
},
|
|
},
|
|
},
|
|
compilerOptions: {
|
|
allowJs: true,
|
|
},
|
|
});
|
|
|