Open flycj opened 3 months ago
There may be some deviations in your understanding. This is the same as the include
and rootDirs
of tsconfig.json
. Your current project structure looks a bit strange. You can check it out yourself.
If you want to develop module documentation, you can take a look at https://modernjs.dev/module-tools/guide/basic/use-module-doc.html
There may be some deviations in your understanding. This is the same as the
include
androotDirs
oftsconfig.json
. Your current project structure looks a bit strange. You can check it out yourself.If you want to develop module documentation, you can take a look at https://modernjs.dev/module-tools/guide/basic/use-module-doc.html
in the document, route.include is: Add some extra files in the route. By default, only the files in the document root directory will be included in the route. If you want to add some extra files to the route, you can use this option.
I was also inspired by this issue:https://github.com/web-infra-dev/rspress/issues/180#issuecomment-1765991356
So I think the purpose of this configuration is to add some routing configurations outside of the root directory
Sorry, I think your understanding is correct~
According to the code, the route.include
should be written as a relative path relative to root
, so you can change it to ['../packages/mobile/**/*']
.
There is still a problem in the current code implementation that the extensions configuration is not automatically added to glob expressions in route.include
. You can temporarily use ['../packages/mobile/**/*.md']
, and we will fix it later.
@sanyuan0704 Please help confirm what the relative path writing method in this place is expected to be and should we apply the extensions
configuration to the include
configuration, this will impose some restrictions on users writing include
config.
@flycj For the scene "Add some extra files in the route", we will not recommend the route.include
config and this config may be deprecated in the next major version. It's better to use addPages
hook in a custom Rspress plugin because you can specify the page route and filepath/content, which is more flexible and reasonable than the route config.
@flycj For the scene "Add some extra files in the route", we will not recommend the
route.include
config and this config may be deprecated in the next major version. It's better to useaddPages
hook in a custom Rspress plugin because you can specify the page route and filepath/content, which is more flexible and reasonable than the route config.
Thank you very much for your reply. I will verify it in the next two days
Version
Details
环境: windows 10, node: 16.19
我在一个monorepo项目种通过这样的配置
没有生成对应的可访问路径
检查方式是,写了一个测试插件
然后通过日志打印发现没有路由信息
而我的项目种确实有对应的md文件,这是什么问题呢?
,我看了rspress项目代码, 感觉这一行代码有问题
https://github.com/web-infra-dev/rspress/blob/94e1b0fb0d730b21bde863f5a8244c254e72eaf7/packages/core/src/node/route/RouteService.ts#L145
cwd: this.#scanDir,
这个扫描目录是从config.root定义的目录扫描的吧,但是 config.route.include 我理解应该是从 include的值结合项目根目录进行扫描才对, 一般是非config.root定义的目录,不知道理解的对不对,请指正Reproduce link
运行demo在下面的文件中
Reproduce Steps
dzj-module1.zip 项目最简单的demo包,下载安装依赖即可运行