Search code examples
javascriptpolymerpolymer-2.xtranspiler

Transpiling or not transpiling Polymer 2 applications?


I am writing a Polymer 2 application. The default is to transpile ES6 to ES5 so that you can use ES6 syntax and be sure it will just work.

The problem with this is that everybody (even supporting browsers) get to receive transpiled code.

Two questions:

  • Is it just too crazy to say "no" to legacy browsers, and just stop transpiling?

  • Is there an easy-ish way to redirect specific browsers to a non-transpiled version of the app?


Solution

  • The simple answer isL use prpl-server-node which does exactly what I was talking about, and more. Specifically:


    Differential Serving

    Modern browsers offer great features that improve performance, but most applications need to support older browsers too. prpl-server can serve different versions of your application to different browsers by detecting browser capabilities using the user-agent header.

    Builds

    prpl-server understands the notion of a build, a variant of your application optimized for a particular set of browser capabilities.