[Feature] Use lodash-es instead of lodash. #1587
Labels
CLI
MQTTX CLI
dependencies
Pull requests that update a dependency file
desktop
MQTTX Desktop
enhancement
New feature or request
feature
This pr is a feature
web
MQTTX Web
Milestone
Motivation
我注意到MQTTX在使用lodash库时,并未选择lodash-es,而且在很多地方是全局引入而非按需引入。在构建过程中,优先选择ES模块格式的依赖包,能更好地支持tree-shaking,从而优化打包结果。同时,由于MQTTX是基于electron的应用,我们无需担心对es5的兼容问题。如果我们采用lodash-es并进行按需引入,那么构建出来的产物将会更小,性能也会得到提升。
I noticed that MQTTX is using the lodash library, but did not choose lodash-es, and in many places it is globally imported instead of being imported on demand. During the build process, prioritizing dependencies in the ES module format can better support tree-shaking, thereby optimizing the packaging results. At the same time, since MQTTX is an application based on electron, we don't need to worry about compatibility with es5. If we use lodash-es and import it on demand, the resulting build will be smaller and performance will be improved.
Detailed design
Alternatives
保持现状,因为这个性能提升是有限的,预计也只能减少100KB的产物。
Maintain the status quo, because this performance improvement is limited, and it is expected to only reduce the product by 100KB.
More detail (optional)
https://vuejs.org/guide/best-practices/performance.html
The text was updated successfully, but these errors were encountered: