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

[Enhance] Rax SSR 包体积优化 #750

Open
fengzilong opened this issue Jun 9, 2021 · 5 comments
Open

[Enhance] Rax SSR 包体积优化 #750

fengzilong opened this issue Jun 9, 2021 · 5 comments

Comments

@fengzilong
Copy link
Contributor

  • 移除 useEffect 等在服务端不执行的代码,再移除无用的 import
  • 增加用户配置,修改构建 SSR 时 @babel/preset-env 插件中 targets.node 版本,减少 babel 的语法转换
  • 实际使用中,部分场景 platform-loader 没有生效
@fengzilong fengzilong changed the title Rax SSR 包体积优化 [Enhance] Rax SSR 包体积优化 Jun 9, 2021
@SoloJiang
Copy link
Contributor

SSR 的包体积极致优化的目的是?

@SoloJiang
Copy link
Contributor

SoloJiang commented Jun 9, 2021

babel 语法转化这个对构建速度的影响应该也还好,目前只编译源码不会编译 node_modules,你指的是更高级语法对性能更好?如果业务有自己的诉求可以在 build.json 配置:https://rax.js.org/docs/guide/build-config#browserslist

@SoloJiang
Copy link
Contributor

platform-loader 这个可以参考「跨端三方包研发规范」这个 RFC

@fengzilong
Copy link
Contributor Author

babel 语法转化这个对构建速度的影响应该也还好,目前只编译源码不会编译 node_modules,你指的是更高级语法对性能更好?如果业务有自己的诉求可以在 build.json 配置:rax.js.org/docs/guide/build-config#browserslist

关于这点我又想了一下,node 的 targets 和 web 的 targets 得允许用户单独配置,不然 node 的 targets 会影响 web

@fengzilong
Copy link
Contributor Author

fengzilong commented Jun 9, 2021

使用 "Modern JavaScript" 对体积和性能的影响可以参考这里

snapshot

原文:Publish, ship, and install modern JavaScript for faster applications

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

2 participants