Search code examples
javascriptpolymerinternet-explorer-11polyfills

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


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?


Solution

  • 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.