我使用 Polymer 2.0 编写了一个应用程序,其入口点是 CMS 中的一个页面。该页面加载 polyfill,导入应用程序的入口点,并将自定义元素放入页面中。这个过程在 Chrome 和 Firefox 中运行良好;然而,在 Edge 中,存在一个问题。我在 JavaScript 控制台中收到类似这样的错误:
Object doesn't support property or method 'PropertyEffects'
Unable to get property '__mixinSet' of undefined or null reference
Function is not a constructor
该应用使用的是常规的、未构建的源代码。如何解释或解决这些错误?
最佳答案
您使用哪个版本的 Edge?
Polymer serve 来源的注释 ( https://github.com/Polymer/polyserve/blob/master/src/compile-middleware.ts#L150 )
// Note: The Edge user agent uses the EdgeHTML version, not the main
// release version (e.g. EdgeHTML 15 corresponds to Edge 40). See
// https://en.wikipedia.org/wiki/Microsoft_Edge#Release_history.
//
// Versions before 15.15063 may contain a JIT bug affecting ES6
// constructors (see #161).
因此,对于此版本之前的 Edge,您仍然需要提供替代的 ES5 版本。
如果您正在使用 polymer serve
,它会在需要时即时将您的 ES6 转换为 ES5。
对于其他一切,您应该使用 polymer build
来提供 ES5 代码。如果需要,你可以上菜。 (通过用户代理字符串检查服务器)
关于javascript - Polymer 2.0 边缘问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44330567/