Webcomponents polyfills 在 Edge 上失败
Webcomponents polyfills fail on Edge
我正在尝试将 Polymer 2 组件集成到现有的 SPA([ab]使用 JSF 构建)。
只要我的 POC 是 Chrome 中的 运行,我就可以使用基础知识,而且我真的不在乎它是在 Shadow 还是 Shady DOM 中呈现(但是。两者都已成功测试)。此外,还没有 Polymer 构建。
但一切都很好。
进入 MS Edge。
现在我需要 polyfill 每个平台功能,但我对此很好:
我做了 bower install webcomponentsjs 并且我还 <script>
-included webcomponents-lite.js
,我 html 中的第一件事header。
即使 强制所有 polyfills,在 Chrome.
中一切正常
MS Edge 只为以下文件(non-exhaustive 列表)生成大量 HTTP 404s:
- (XHR)获取 -
localhost:9980/my/application/root/bower_components/webcomponentsjs/%20[合成:util/global]
- [...]root/bower_components/webcomponentsjs/webcomponents-hi-sd-ce-pf-index.js
- [...]root/bower_components/node_modules/@webcomponents/shadycss/src/scoping-shim.js
+
63 个以上,类似的失败请求,都指向 bower_components/node_modules
有趣的是,我的设置中存在 none 个,在 运行 之后 bower install
。它们应该被生成吗?如果是这样,在什么 build/setup 步骤中?
包括 webcomponents-loader
而不是 webcomponents-lite
没有任何区别。
Webcomponents polyfill 包含在 header 中;聚合物库最后。中间加载了一些其他 JavaScript 库,用于呈现应用程序。
在应用程序本身被呈现和初始化之后,组件被实例化和 lazy-loaded on-demand。但我怀疑 Edge 在此之前很久就停止了任何 WC-related。
此外,由于 F12 调试工具的网络选项卡在加载时立即死亡,我无法调试任何网络 activity(例如正确加载 webcomponents-[lite|loader])。
我的应用程序由 WebSphere Liberty 配置文件 (Windows 7) 提供服务,这可能会或可能不会产生重大影响。也许这是 file/disk 权限的问题?我该如何检查?
我知道这个问题看起来与 非常相似,但我决定对我的环境进行更全面的描述,因为我怀疑这就是问题所在。
任何想法表示赞赏。
Edge 可以正常工作,但使用 F12 开发人员工具会出现问题。
事实证明,这与我的上下文完全无关;同样的问题适用于使用初学者工具包创建的项目。
请参阅 https://github.com/PolymerElements/polymer-starter-kit/issues/1025 了解另一个角度:
@Inrego commented on 27 Jul:
I updated polymer-cli and used polymer init followed by polymer serve
Result: Without F12 window, the app loads. With F12 window open, the app doesn't load, and a few js errors are thrown.
我找到了罪恶的真正根源,至少在我非常具体的背景下(见 OP):
webcomponentsjs-polyfills 修改本机 DOM 功能,该功能由同一页面中包含的任何其他框架使用!
因此,虽然 Web 组件可能仍会快速呈现(取决于它们自己的实现),但 polyfill 也会严重影响封装页面的呈现行为(和性能)。
因此,如果你有很多命令式 DOM 操作正在进行(就像我一样),那么 page/app 很可能会痛苦地缓慢死亡。
我正在尝试将 Polymer 2 组件集成到现有的 SPA([ab]使用 JSF 构建)。 只要我的 POC 是 Chrome 中的 运行,我就可以使用基础知识,而且我真的不在乎它是在 Shadow 还是 Shady DOM 中呈现(但是。两者都已成功测试)。此外,还没有 Polymer 构建。 但一切都很好。
进入 MS Edge。
现在我需要 polyfill 每个平台功能,但我对此很好:
我做了 bower install webcomponentsjs 并且我还 <script>
-included webcomponents-lite.js
,我 html 中的第一件事header。
即使 强制所有 polyfills,在 Chrome.
MS Edge 只为以下文件(non-exhaustive 列表)生成大量 HTTP 404s:
- (XHR)获取 - localhost:9980/my/application/root/bower_components/webcomponentsjs/%20[合成:util/global]
- [...]root/bower_components/webcomponentsjs/webcomponents-hi-sd-ce-pf-index.js
- [...]root/bower_components/node_modules/@webcomponents/shadycss/src/scoping-shim.js
+
63 个以上,类似的失败请求,都指向 bower_components/node_modules
有趣的是,我的设置中存在 none 个,在 运行 之后 bower install
。它们应该被生成吗?如果是这样,在什么 build/setup 步骤中?
包括 webcomponents-loader
而不是 webcomponents-lite
没有任何区别。
Webcomponents polyfill 包含在 header 中;聚合物库最后。中间加载了一些其他 JavaScript 库,用于呈现应用程序。 在应用程序本身被呈现和初始化之后,组件被实例化和 lazy-loaded on-demand。但我怀疑 Edge 在此之前很久就停止了任何 WC-related。 此外,由于 F12 调试工具的网络选项卡在加载时立即死亡,我无法调试任何网络 activity(例如正确加载 webcomponents-[lite|loader])。
我的应用程序由 WebSphere Liberty 配置文件 (Windows 7) 提供服务,这可能会或可能不会产生重大影响。也许这是 file/disk 权限的问题?我该如何检查?
我知道这个问题看起来与
任何想法表示赞赏。
Edge 可以正常工作,但使用 F12 开发人员工具会出现问题。
事实证明,这与我的上下文完全无关;同样的问题适用于使用初学者工具包创建的项目。
请参阅 https://github.com/PolymerElements/polymer-starter-kit/issues/1025 了解另一个角度:
@Inrego commented on 27 Jul: I updated polymer-cli and used polymer init followed by polymer serve Result: Without F12 window, the app loads. With F12 window open, the app doesn't load, and a few js errors are thrown.
我找到了罪恶的真正根源,至少在我非常具体的背景下(见 OP):
webcomponentsjs-polyfills 修改本机 DOM 功能,该功能由同一页面中包含的任何其他框架使用!
因此,虽然 Web 组件可能仍会快速呈现(取决于它们自己的实现),但 polyfill 也会严重影响封装页面的呈现行为(和性能)。 因此,如果你有很多命令式 DOM 操作正在进行(就像我一样),那么 page/app 很可能会痛苦地缓慢死亡。