Here's a very bare bones approach.
First, create a webpack.config.js
file. This is what goes in:
const config = {
entry: 'src/index.js', // path to your app entry point
output: {
path: path.resolve(__dirname, 'dist'), // output goes to the dist folder relative to this file
filename: 'bundle.js',
},
module: {
rules: [ // Here is all your loaders etc, compilators etc
{
test: /.jsx?$/, // run this loader for all files that end in .js and .jsx
loader: 'babel-loader', // the loader is called babel-loader
options: { // it accepts options, which can also be set in a .babelrc file if you want
presets: ['latest', 'react'], // we want to transpile ES2015 to ES5 and react JSX code
}
}
],
},
};