Polymer serve changes the served javascript files for Internet Explorer 11. How to make it work on another web server?

て烟熏妆下的殇ゞ 提交于 2019-12-11 04:34:20

问题


When testing our polymer 2.01 / webcomponents 1.01 Application on Internet Explorer 11 we found out that it works fine using poyfills when serving the Application with polymer serve.

It doesn't work when we are serving our application with a naked tomcat 8.x. We get Script Errors like "SCRIPT1003: Expected" with Internet Explorer.

The reason for this seems to that polymer serve changes the javascript files when the Client Browser is Internet Explorer 11.

For example in webcomponents-lite.js

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === 
"symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

is added to the beginning of the javascript file when the client Broswer is IE11. I guess this is necessary to make it run on IE11.

So what do we have to do to make it work on IE11 when not using polymer serve?


回答1:


The problem is solved now, I had to compile the code into ES5, then it also works in IE11 now. You can do that in the build options of polymer.json.



来源:https://stackoverflow.com/questions/44323065/polymer-serve-changes-the-served-javascript-files-for-internet-explorer-11-how

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!