问题描述
在开发中启动react.js时,需要3到5分钟的时间来加载。时间会有所不同,启动后它会根据更改刷新得足够快...
在进行生产构建时,也需要很多时间。
这可能导致什么? 有一些巨大的组件,例如500〜条线,有些组件具有〜2k条线。 庞大的组件会导致这种情况吗?
第一次更新-今天尝试在开发中启动React应用4次。
- 开发中的第一个开始花了4分钟10秒。
- 第二次开发花费了3分12秒。
- 第三次开发花了2分30秒。
- 第四次开发过程耗时2分35秒。
还尝试构建生产版本,并查看确切需要多长时间。
- 首次生产-7分27秒。
- 第二个生产版本-3分41秒。
- 第三个生产版本(删除了所有版本文件)-3分34秒。
那些拥有500到2k行代码的大型组件也不是我的设计选择。当我加入项目时,我发现它就像那样。现在我只是想知道花这么长时间启动开发服务器来做出反应是否可以。
构建完成后输出消息:
File sizes after gzip:
2.37 MB build/static/js/2.6d79667f.chunk.js
72.79 KB build/static/css/2.37cd983e.chunk.css
52.85 KB build/static/js/main.375a34e0.chunk.js
2.17 KB build/static/css/main.5827d774.chunk.css
796 B build/static/js/runtime-main.a4023761.js
The bundle size is significantly larger than recommended.
Consider reducing it with code splitting: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#code-splitting
You can also analyze the project dependencies: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#analyzing-the-bundle-size
The project was built assuming it is hosted at http://localhost:5050/.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
Find out more about deployment here:
https://github.com/facebook/create-react-app/blob/master/packages/cra-template/template/README.md
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)