/*
* @Author: weisheng
* @Date: 2023-07-27 10:26:09
* @LastEditTime: 2025-09-23 10:35:39
* @LastEditors: weisheng
* @Description:
* @FilePath: /wot-design-uni/docs/.vitepress/config.mts
* 记得注释
*/
import { defineConfig } from 'vitepress';
import viteCompression from 'vite-plugin-compression'
import { fileURLToPath, URL } from 'node:url'
import { MarkdownTransform } from './plugins/markdown-transform'
import { VersionBadgePlugin } from './plugins/version-badge'
import llmstxt from 'vitepress-plugin-llms'
import enUS from './locales/en-US'
import zhCN from './locales/zh-CN'
export default defineConfig({
vite: {
plugins: [
llmstxt({
ignoreFiles: ['reward/*', 'index.md', 'README.md', 'en-US/*.md', 'en-US/**/*.md', 'ads/*', 'guide/cases.md', 'guide/changelog.md', 'guide/join-group.md', 'guide/typography.md'],
domain: 'https://wot-ui.cn',
}),
MarkdownTransform(),
VersionBadgePlugin(),
viteCompression({
verbose: true,
disable: false,
threshold: 10240,
algorithm: 'gzip',
ext: '.gz',
}),
],
ssr: { noExternal: ['element-plus'] },
resolve: {
alias: [
{
find: /^.*\/VPSidebar\.vue$/,
replacement: fileURLToPath(
new URL('./theme/components/VPSidebar.vue', import.meta.url)
)
},
{
find: /^.*\/VPContent\.vue$/,
replacement: fileURLToPath(
new URL('./theme/components/VPContent.vue', import.meta.url)
)
},
{
find: /^.*\/VPDoc\.vue$/,
replacement: fileURLToPath(
new URL('./theme/components/VPDoc.vue', import.meta.url)
)
},
{
find: /^.*\/VPLocalNav\.vue$/,
replacement: fileURLToPath(
new URL('./theme/components/VPLocalNav.vue', import.meta.url)
)
},
{
find: /^.*\/VPNavBar\.vue$/,
replacement: fileURLToPath(
new URL('./theme/components/VPNavBar.vue', import.meta.url)
)
},
{
find: /^.*\/VPSidebarItem\.vue$/,
replacement: fileURLToPath(
new URL('./theme/components/VPSidebarItem.vue', import.meta.url)
)
}
]
}
},
title: `Wot UI`,
description: '一个参照wot-design打造的uni-app组件库',
locales: {
root: {
label: '简体中文',
lang: 'zh-CN',
...zhCN
},
'en-US': {
label: 'English',
lang: 'en-US',
...enUS,
}
},
head: [
['link', { rel: 'icon', href: '/favicon.ico' }],
['script', {}, `
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?c77588a5308ea5813c1d46bdd849338b";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
`]
],
themeConfig: {
logo: '/logo.png',
lastUpdated: {
text: '最后更新'
},
editLink: {
pattern: 'https://github.com/Moonofweisheng/wot-design-uni/edit/master/docs/:path',
text: '为此页提供修改建议',
},
socialLinks: [
{ icon: 'github', link: 'https://github.com/Moonofweisheng/wot-design-uni' },
{ icon: { svg: '' }, link: "https://gitee.com/wot-design-uni/wot-design-uni", ariaLabel: 'Gitee' },
{ icon: { svg: '' }, link: "/guide/join-group", ariaLabel: 'QQ' },
{ icon: { svg: '' }, link: 'https://juejin.cn/user/26044011388510/posts' },
],
search: {
provider: 'algolia',
options: {
appId: 'A74X2RFXSU',
apiKey: '6961856d63f5181bf71cb4fa3e4398d2',
indexName: 'wot-design-uni2',
},
},
footer: {
message: `Released under the MIT License.`,
copyright: 'Copyright © 2023-present weisheng',
},
},
})