fix: doc build error

This commit is contained in:
xingyu4j
2026-05-18 20:17:35 +08:00
parent 7c943cc06b
commit 5db93a345a
10 changed files with 200 additions and 100 deletions

View File

@@ -0,0 +1,2 @@
import { register } from 'node:module';
register('./dayjs-resolve-hook.mjs', import.meta.url);

View File

@@ -0,0 +1,10 @@
const DAYJS_SUBPATH_RE = /^dayjs\/(plugin|locale)\/([^./]+)$/;
/** @type {import('node:module').ResolveHook} */
export async function resolve(specifier, context, nextResolve) {
const match = specifier.match(DAYJS_SUBPATH_RE);
if (match) {
return nextResolve(`${specifier}.js`, context);
}
return nextResolve(specifier, context);
}

View File

@@ -5,6 +5,7 @@ import { resolve } from 'node:path';
import {
viteArchiverPlugin,
viteDayjsPlugin,
viteVxeTableImportsPlugin,
} from '@vben/vite-config';
@@ -69,6 +70,7 @@ export const shared = defineConfig({
stringify: true,
},
plugins: [
viteDayjsPlugin(),
tailwindcss(),
GitChangelog({
mapAuthors: [
@@ -86,6 +88,7 @@ export const shared = defineConfig({
username: 'likui628',
},
{
mapByNameAliases: ['Jin Mao', 'jinmao'],
name: 'Jin Mao',
username: 'jinmao88',
},
@@ -94,6 +97,7 @@ export const shared = defineConfig({
username: 'mynetfan',
},
{
mapByNameAliases: ['xingyu4j', 'xingyu'],
name: 'xingyu4j',
username: 'xingyu4j',
},
@@ -115,6 +119,7 @@ export const shared = defineConfig({
ssr: {
external: ['@vue/repl'],
noExternal: ['@v-c/picker'],
},
},
});
@@ -125,7 +130,7 @@ function head(): HeadConfig[] {
[
'meta',
{
content: 'vben, vitejs, vite, shacdn-ui, vue',
content: 'vben, vitejs, vite, shadcn-ui, vue',
name: 'keywords',
},
],

View File

@@ -2,8 +2,9 @@
"name": "@vben/docs",
"version": "5.7.0",
"private": true,
"type": "module",
"scripts": {
"build": "vitepress build",
"build": "cross-env NODE_OPTIONS=\"--import ./.vitepress/build/dayjs-loader.mjs\" vitepress build",
"dev": "vitepress dev",
"docs:preview": "vitepress preview"
},