Are you ripping your hair out trying to figure out how to get webpack
to understand ES6 syntax?
I just spent 2 hours trying to figure this out. Ok, I’m lying it was more hours than I want to admit.
I just want to save everyone time.
Name your config file webpack.config.babel.js
.
Install the following packages:
1 | npm install --save-dev webpack babel-register babel-preset-es2015 |
Create a .babelrc
file. This is the important bit I was missing!
1 | { |
Now you can run webpack
successfully!