bruno yang

Results 9 comments of bruno yang

能贴下具体的报错信息吗

@wonyun 首先感谢回复。行文上可能有疏漏引起误解。因为 babel-runtime 都是自动帮你引入所需 polyfill,但每个文件引入的都是全量的 polyfill,很容易引起体积暴涨。所以我们可以加上 babel-plugin-transform-runtime,这样 runtime 所用的 polyfill 就会从 transform-runtime 里引入,就避免了体积暴涨的问题。

@wonyun 应该这么说,Babel 中 runtime 只是个 helper 函数库,runtime transform 根据 ast 结果帮你引入所需 helper 函数。所以是只用 runtime 是需要手动,但不要这样用,而是用 runtime transform。

@qianlongo 谢谢指正 👍

@puncha 👍 多谢提醒,已在结尾补充

ok 已更新

@mlyknown 如果你是指单纯地使用 registerElement 会不会造成资源大量占用,答案是不会。因为registerElement 只是给 dom 元素的原型上加了几个方法而已。如果配合 IntersectionObserver 一起使用的话,_可能_会造成卡顿内存暴涨之类的问题。我在 mac 上测试,监听了 500 个 dom,没有什么问题,fps 稳稳的 60。当然,也要注意及时`unobserve`。