I'm setting up a React environment with NPM for dependencies, Webpack for bundling and Babel to be able to code ES6. I want to be able to use ES6 everywhere on my project.
I have my webpack.config.js file setup to use 'babel-loader' as follows:
var webpack = require ('webpack')
var path = require ('path')
var DIST_DIR = path.resolve(__dirname, 'dist')
var SRC_DIR = path.resolve(__dirname, 'src')
module.exports = {
entry: SRC_DIR + '/app/index.js',
output: {
path: DIST_DIR + '/app',
filename: 'bundle.js',
publicPath: '/app/'
},
module: {
loaders: [
{
test: /\.jsx?/,
include: SRC_DIR,
loader: 'babel-loader',
query: {
presets: [ 'react', 'es2015', 'stage-2' ]
}
}
]
}
}
Everything works as expected, But this file (webpack.config.js) is not written in ES6!
Is it possible to be able to use ES6 all along my project? If yes, where do I have to setup Babel and its presets?
Note: I'm using node v6.10.2