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

关于文档项目的site打包离线运行时,点击显示代码报错 #46544

Closed
CLXGGG opened this issue Dec 20, 2023 · 7 comments
Closed

Comments

@CLXGGG
Copy link

CLXGGG commented Dec 20, 2023

Reproduction link

https://github.com/CLXGGG/antd-web/blob/main/meta__E

Steps to reproduce

git clone antd的github上的文档项目,yarn 安装依赖,yarn site 打包,用nginx等运行工具跑起来。进入其中一个组件页面,点击显示代码。报错。

What is expected?

打包后离线运行能正常显示示例代码。

What is actually happening?

报错
ChunkLoadError: Loading chunk 98341 failed.
(error: http://localhost:8008/meta__E:__zh-CN.02244dde.async.js)

Environment Info
antd 5.12.2
React react
System windows10
Browser edge 119.0.2151.44

网上查找的打包antd离线文档方法都是用site打包。但是运行报错,我猜测是由于site打包后有的文件名命名成了“E:”这种格式,冒号":"是不能用来当文件名的,导致命名失败。重现链接是我site打包后的项目,命名失败文件名变成了“meta__E”。在任意一个组件页面中点击“查看代码”按钮时,会去找文件“meta__E:__zh-CN.02244dde.async.js",就报错了。

另外,本来想用github pages上运行这个项目的,但是运行后提供的链接在域名后加了个项目名:“/antd-web”,于是我配置了publicPath: './'和runtimePublicPath: {},大部分css等文件能访问到了,但还是有文件没改过来:“/dumi__tmp-production__dumi__theme__ContextWrapper.87193992.async.js”,访问它还是"/"而不是"./"相对路径。导致报错。github pages运行链接:https://clxggg.github.io/antd-web

@Wxh16144
Copy link
Member

我之前搞过一个 https://github.com/Wxh16144/antd-docker-docs 不过很久没更新了,你可以借鉴一下?

@MadCcc
Copy link
Member

MadCcc commented Dec 20, 2023

看起来是 win 路径问题,需要去 dumi 解决这个问题
publicPath 配置成 /antd-web 就行

@Wxh16144
Copy link
Member

Wxh16144 commented Dec 20, 2023

路径问题我记得之前 @PeachScript 提过, win 打包和 Unix 打包路径就会不一样。动态路由会有 :
image

@CLXGGG
Copy link
Author

CLXGGG commented Dec 20, 2023

我之前搞过一个 https://github.com/Wxh16144/antd-docker-docs 不过很久没更新了,你可以借鉴一下?

v4版本我以前搞过,那时没这个问题

@MadCcc
Copy link
Member

MadCcc commented Dec 20, 2023

这个问题可以去 dumi 跟踪下,应该是 2.3.0-alpha 的相关问题

@CLXGGG
Copy link
Author

CLXGGG commented Dec 20, 2023

看起来是 win 路径问题,需要去 dumi 解决这个问题 publicPath 配置成 /antd-web 就行

publicPath 配置成 /antd-web 也一样。 /dumi__tmp-production__dumi__theme__ContextWrapper.87193992.async.js 这文件都不受影响

@afc163
Copy link
Member

afc163 commented Dec 29, 2023

Trace umijs/dumi#1990

@afc163 afc163 closed this as completed Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants