Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

动态路由打包后遇到的bug,开发环境正常 #4200

Open
4 tasks done
jay86cn opened this issue Sep 13, 2024 · 3 comments
Open
4 tasks done

动态路由打包后遇到的bug,开发环境正常 #4200

jay86cn opened this issue Sep 13, 2024 · 3 comments
Labels
bug: pending triage Maybe a bug, waiting for confirmation stale

Comments

@jay86cn
Copy link

jay86cn commented Sep 13, 2024

Describe the bug

当我在使用动态路由的功能的时候,开发状态下是正常运行的,如下方的配置

image

export default { paths() { return [ { params: { pkg: '../svgui/important/' }}, { params: { pkg: '../toolkit/important/' }}, ] } }

我在当前目录的上级中的两个目录中分别用当前的md文件生成了两个文件,开发环境一切正常。
但打包之后,对应目录的文件生成了,但是内容却是404。

Reproduction

Expected behavior

希望能改进后,开发环境和生产环境表现一致。

System Info

node 18.19 
windows

Additional context

No response

Validations

@jay86cn jay86cn added the bug: pending triage Maybe a bug, waiting for confirmation label Sep 13, 2024
@jay86cn
Copy link
Author

jay86cn commented Sep 14, 2024

屏幕截图 2024-09-14 080843
[pkg]adaptivePanel.paths.js 代码

屏幕截图 2024-09-14 080347
我的目录结构

以及报错的时候的提示

⠋ rendering pages...Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'E:\Works\Personal\Project\20240811\3.Document\vitepress.vitepress.temp\cn_svgui_important_adaptivePanel.md.js' imported from E:\Works\Personal\Project\20240811\3.Document\vitepress.vitepress.temp\app.js
at new NodeError (node:internal/errors:405:5)
at finalizeResolution (node:internal/modules/esm/resolve:327:11)
at moduleResolve (node:internal/modules/esm/resolve:980:10)
at defaultResolve (node:internal/modules/esm/resolve:1193:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:403:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:372:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38)
at ModuleLoader.import (node:internal/modules/esm/loader:335:34)
at importModuleDynamically (node:internal/modules/esm/translators:143:35)
at importModuleDynamicallyCallback (node:internal/modules/esm/utils:112:14) {
url: 'file:///E:/Works/Personal/Project/20240811/3.Document/vitepress/.vitepress/.temp/cn_svgui_important_adaptivePanel.md.js',
code: 'ERR_MODULE_NOT_FOUND'
}
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'E:\Works\Personal\Project\20240811\3.Document\vitepress.vitepress.temp\cn_toolkit_important_adaptivePanel.md.js' imported from E:\Works\Personal\Project\20240811\3.Document\vitepress.vitepress.temp\app.js
at new NodeError (node:internal/errors:405:5)
at finalizeResolution (node:internal/modules/esm/resolve:327:11)
at moduleResolve (node:internal/modules/esm/resolve:980:10)
at defaultResolve (node:internal/modules/esm/resolve:1193:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:403:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:372:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38)
at ModuleLoader.import (node:internal/modules/esm/loader:335:34)
at importModuleDynamically (node:internal/modules/esm/translators:143:35)
at importModuleDynamicallyCallback (node:internal/modules/esm/utils:112:14) {
url: 'file:///E:/Works/Personal/Project/20240811/3.Document/vitepress/.vitepress/.temp/cn_toolkit_important_adaptivePanel.md.js',
code: 'ERR_MODULE_NOT_FOUND'
}
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'E:\Works\Personal\Project\20240811\3.Document\vitepress.vitepress.temp\cn_svgui_important_panel3D.md.js' imported from E:\Works\Personal\Project\20240811\3.Document\vitepress.vitepress.temp\app.js
at new NodeError (node:internal/errors:405:5)
at finalizeResolution (node:internal/modules/esm/resolve:327:11)
at moduleResolve (node:internal/modules/esm/resolve:980:10)
at defaultResolve (node:internal/modules/esm/resolve:1193:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:403:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:372:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38)
at ModuleLoader.import (node:internal/modules/esm/loader:335:34)
at importModuleDynamically (node:internal/modules/esm/translators:143:35)
at importModuleDynamicallyCallback (node:internal/modules/esm/utils:112:14) {
url: 'file:///E:/Works/Personal/Project/20240811/3.Document/vitepress/.vitepress/.temp/cn_svgui_important_panel3D.md.js',
code: 'ERR_MODULE_NOT_FOUND'
}
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'E:\Works\Personal\Project\20240811\3.Document\vitepress.vitepress.temp\cn_toolkit_important_panel3D.md.js' imported from E:\Works\Personal\Project\20240811\3.Document\vitepress.vitepress.temp\app.js
at new NodeError (node:internal/errors:405:5)
at finalizeResolution (node:internal/modules/esm/resolve:327:11)
at moduleResolve (node:internal/modules/esm/resolve:980:10)
at defaultResolve (node:internal/modules/esm/resolve:1193:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:403:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:372:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:249:38)
at ModuleLoader.import (node:internal/modules/esm/loader:335:34)
at importModuleDynamically (node:internal/modules/esm/translators:143:35)
at importModuleDynamicallyCallback (node:internal/modules/esm/utils:112:14) {
url: 'file:///E:/Works/Personal/Project/20240811/3.Document/vitepress/.vitepress/.temp/cn_toolkit_important_panel3D.md.js',
code: 'ERR_MODULE_NOT_FOUND'
}

@jay86cn
Copy link
Author

jay86cn commented Sep 14, 2024

以前用过dumi,以及查询看过一众的同类型的静态站点工具(主要用来写文档),目前vitepress是最好用的。

@jay86cn
Copy link
Author

jay86cn commented Sep 14, 2024

image

image

当我把目录结构和代码改为上图这样,打包是正常的,也不报错了,相关文件中的代码也不再是404,但在我访问的一瞬间是正常的,但马上会被404页面所取代,因为速度太快了,我无法截取到正常访问的图片。

但不论我使用哪种目录结构和配置,开发环境一切正常!!仅仅是打包后出现此问题。

image

@jay86cn jay86cn changed the title 动态路由遇到的bug 动态路由打包后遇到的bug,开发环境正常 Sep 14, 2024
@github-actions github-actions bot added the stale label Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: pending triage Maybe a bug, waiting for confirmation stale
Projects
None yet
Development

No branches or pull requests

1 participant