

Next, you’ll need to install any presets and plugins you need. Once you’re ready, start by installing the babel-core and babel-loader packages: npm install babel-core babel-loader -save-dev

My favourite tool for this is Webpack, and as it happens, Webpack has great Babel support through babel-loader…īefore we start - if you’re currently using Babel 5, first remove its packages from your project’s package.json file and then npm uninstall them - babel, babel-core, babel-loader, etc. To make our Babel output browser friendly, we’ll need to bundle it. However, when Babel encounters an import statement, it outputs a require call – which won’t get you very far in the browser.

The Babel CLI is great for compiling ES6 to ES5 on a file-by-file basis. If you’re having trouble upgrading to Babel 6, start with Six Things You Need To Know About Babel 6. This guide is part of The Complete Guide to ES6 with Babel 6 series.
