gpt4 book ai didi

ecmascript-6 - 在 babeljs 6 中修复 `mutating the [[Prototype]] of an object`

转载 作者:行者123 更新时间:2023-12-04 18:01:56 24 4
gpt4 key购买 nike

使用类时,firefox 不断警告我:

mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create

有没有办法通过让 babel 不设置原型(prototype)来消除这个错误?

我认为以前在我使用 protoToAssign(现在是 babel-plugin-transform-proto-to-assign)时没有出现是因为 firefox 忽略了 setPrototypeOf.

最佳答案

Afaik,如果您从内置类继承,Babel 只会改变对象的 [[prototype]]。如果您想在 ES5 环境中运行代码,请不要这样做。

关于ecmascript-6 - 在 babeljs 6 中修复 `mutating the [[Prototype]] of an object`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33858349/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com