CustomElements.js:596Uncaught TypeError: Cannot assign to read only property 'customElements' of object '#<Window>'

CustomElements.js:596Uncaught TypeError: Cannot assign to read only property 'customElements' of object '#<Window>'

我们正在利用 skateJS 并使用 webcomponent.js 作为 polyfill。但是,自从今天 Google Chrome(版本 54.0.2840.71)的新版本发布以来,我们的应用程序抛出了一个致命错误。

CustomElements.js:596Uncaught TypeError: 无法分配给对象 '#'

的只读 属性 'customElements'

从版本 54 开始,Chrome 引入了一个名为 customElements 的新 gobal 变量,实际上是 window.customElements,它是自定义元素 v1 规范的一部分。

它必须与您在自己的代码中使用的相同变量发生冲突(在文件 CustomElements.js 中猜测)。您需要重命名它。