Files
2026-10-08 11:34:12 +08:00

45 lines
1.5 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { fileURLToPath } from 'node:url'
/**
* 文档站(Docus)。
*
* 几个刻意的选择:
* - extends: ['docus'] —— Docus 是 Nuxt Layer,全部能力(导航、搜索、主题)由它提供
* - alias 直连 packages 源码 —— 组件库尚未构建也能开发,改组件即时热更
*
* 部署到子路径时用环境变量 NUXT_APP_BASE_URL=/docs/,不在配置里写死。
*/
export default defineNuxtConfig({
extends: ['docus'],
// sitemap.xml、llms.txt、OG image 都依赖站点 URL,缺了会导致预渲染 500
site: {
url: process.env.DOCS_SITE_URL || 'https://ui.g3soft.dev',
name: 'G3Soft 技术文档',
},
// 监听所有网卡:控制台会打印可用的 Local(http://localhost:PORT) 与 Network(局域网地址)。
// 这里必须用空串而不是 '0.0.0.0':listhen 把空串当“全部网卡”,且生成 URL 时回退成 localhost;
// 而 '0.0.0.0' 会把 Local 那行显示成 http://0.0.0.0:PORT(浏览器打不开)。
devServer: {
host: '',
},
vite: {
resolve: {
alias: {
'@g3soft/ui': fileURLToPath(new URL('../packages/ui/src/index.ts', import.meta.url)),
'@g3soft/tokens': fileURLToPath(
new URL('../packages/tokens/src/index.css', import.meta.url),
),
},
},
server: {
fs: {
// 组件库源码在 docs 目录之外,需要放开读取范围
allow: [fileURLToPath(new URL('..', import.meta.url))],
},
},
},
})