Deploying ES2015+ Code in Production Today

Deploying ES2015+ Code in Production Today

Most web developers I talk to these days love writing JavaScript with all the newest language features—async/await, classes, arrow functions, etc. However, despite the fact that all modern browsers can run ES2015+ code and natively support the features I just mentioned, most developers still transpile their code to ES5 and bundle it with polyfills to accommodate the small percentage of users still on older browsers.

[…]

If you’re already using a module bundler like webpack or rollup to generate your JavaScript today, you should continue to do that.

[…]

When run, these two configs will output two, production-ready JavaScript files:

[…]

I created webpack-esnext-boilerplate so developers could see a real implementation of this technique.

[…]

If you’re using a tool other than webpack to generate your production bundles, the process is more or less the same. I chose to demo this using webpack here because it’s currently the most popular bundler, and it’s also the most complex. I figure if the technique can work with webpack, it can work with anything.

[…]