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] build构建COMPRESS有问题 !umi-app + three, build后的页面,在移动端上 glb模型加载失败!PC端表现正常!已提供 github 测试工程 仓库 #7644

Closed
pxim opened this issue Dec 1, 2021 · 3 comments

Comments

@pxim
Copy link

pxim commented Dec 1, 2021

What happens?

我今天用官方的命令创建了最新的umi-app程序,然后里面代码是react+three,dev模式,我通过内网穿外网插件,在PC端和移动端测试一切都OK;然后我就build后,build后的页面,PC端打开OK,移动端浏览器上 模型加载到一半就直接没结果了;

我能肯定是build构建工具的问题,
为什么这么确定,因为我用creact-react-app里build同样的代码,部署到同样的服务器上,移动端上显示是没问题的

业务代码一模一样;

creact-react-app build后的例子:http://bmw.jingge.com:45231/releases/mtest2.3/index.html

umi-app build后的例子:http://bmw.jingge.com:45231/releases/mtest2.5/index.html

为什么不用cra,因为cra构建build也有问题,在模型面数超过100w后,cra的build后的页面不知道为什么性能就下降一半了,但是dev模式下,是正常的;我用umi-app build后的页面,测试性能是ok的,dev和build后的性能能基本保持一致。

---------2021-12-01 19:27 补充------------------------
我在.evn里加了 COMPRESS=none,然后build后,页面在手机端可以正常浏览了,但是我既想代码压缩,又想浏览正常,我该怎么操作
这是 COMPRESS=none build后的页面 http://bmw.jingge.com:45231/releases/umi-test2/index.html

How To Reproduce

测试工程项目:[[email protected]:pxim/umiapp-glb-build-test.git](https://github.com/pxim/umiapp-glb-build-test)
测试工程build后页面:http://bmw.jingge.com:45231/releases/umi-test/index.html

  1. 下载
  2. yarn install
  3. npm run build
  4. 测试

Steps to reproduce the behavior: 1. 2.

Expected behavior 1. 2.

Context

  • Umi Version:
  • Node Version:
  • Platform:

Please,help me ! !!我已经被这个 start dev 和 build 后,页面功能,性能,相差很大的问题,搞的很疼

@pxim pxim changed the title [Bug] say something [Bug] umi-app + three, build后的页面,在移动端上 模型加载失败!!!PC端表现正常 Dec 1, 2021
@pxim pxim changed the title [Bug] umi-app + three, build后的页面,在移动端上 模型加载失败!!!PC端表现正常 [Bug] umi-app + three, build后的页面,在移动端上 glb模型加载失败!!!PC端表现正常 Dec 1, 2021
@pxim pxim changed the title [Bug] umi-app + three, build后的页面,在移动端上 glb模型加载失败!!!PC端表现正常 [Bug] umi-app + three, build后的页面,在移动端上 glb模型加载失败!!!PC端表现正常!!!已提供 github 测试工程 仓库 Dec 1, 2021
@pxim pxim changed the title [Bug] umi-app + three, build后的页面,在移动端上 glb模型加载失败!!!PC端表现正常!!!已提供 github 测试工程 仓库 [Bug] build构建有问题 !umi-app + three, build后的页面,在移动端上 glb模型加载失败!PC端表现正常!已提供 github 测试工程 仓库 Dec 1, 2021
@pxim pxim changed the title [Bug] build构建有问题 !umi-app + three, build后的页面,在移动端上 glb模型加载失败!PC端表现正常!已提供 github 测试工程 仓库 [Bug] build构建COMPRESS有问题 !umi-app + three, build后的页面,在移动端上 glb模型加载失败!PC端表现正常!已提供 github 测试工程 仓库 Dec 1, 2021
@pxim
Copy link
Author

pxim commented Dec 3, 2021

经过各种测试,现在确定 terserOptions 里的keep_fnames为false的话,mobile端 模型功能会出问题,为true的话,模型功能正常;

@pxim
Copy link
Author

pxim commented Dec 3, 2021

另外 nodeModulesTransform里type: 'all'的话,一旦开启all,模型较大,比如70M以上的时候,页面性能立马下降一半以上;
type: 'none' 页面性能正常;

@chenshuai2144
Copy link
Contributor

看来你碰到了混淆功能的bug。你要不要试试用esbuild 压缩一下

@sorrycc sorrycc closed this as completed Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants