问题
We currently updated a project from Polymer 1 to the Polymer 2/ hybrid version.
I know that webcomponents-hi-sd-ce.js is the polyfill for edge.
When testing the page on Microsoft Edge I now get an error indicating that webcomponents-hi-sd-ce.js.map could not be found (404).
The same error occurs when loading the project with webcomponents-lite.js
I couldn't find similar cases so I figured this might be a issue in Polymer 2. I tried importing the script directly by myself but that didn't help either.
I would appreciate if someone could help me out here or share his experience with a similar problem.
The exact error from Edge v.38:
HTTP500 + for some reason the file path is shown incorrect even though it is actually right in my folder.
https://..../bower_components/webcomponentsjs%20[synthetic:util/global]
回答1:
Debugging the loader, I've found the following issue:
For each absent native platform feature (as determined by the loader) an acronym will be appended to the polyfill URL. Unfortunately, for some combinations of features—-as with MS Edge—-the resulting path is unavailable.
This might have been resolved meanwhile, but I've moved on to just using webcomponents-lite
(since we're only supporting Edge).
回答2:
There seems to be an issue with webcomponentsjs (version ~1.0), that applies to webcomponents-loader and webcomponents-lite. It should work whenever you load the app with F12-Tools closed.
See https://github.com/PolymerElements/polymer-starter-kit/issues/1025 for details, especially July 27th's comment.
回答3:
you should use the webcomponents-loader like so
<!-- Load polyfills; note that "loader" will load these async -->
<script src="bower_components/webcomponentsjs/webcomponents-loader.js"></script>
also a missing map file should actually be no problem as this is "just" used while debugging to see "readable" code instead of the compressed version.
also depending on your Edge version you may need to transpile your code to es5 using polymer build
.
来源:https://stackoverflow.com/questions/44761248/polymer-2-0-webcomponents-loader-js-is-missing-edge-polyfill