As I write webpack.config.js like this
module.exports = { entry: \'./index.jsx\', output: { filename: \'bundle.js\' }, module: { loaders: [{
In the interest of readability and copy-paste coding. Here is the webpack 4 answer from mr rogers comment in this thread.
module: { rules: [ { test: /\.(js|jsx)$/, exclude: /node_modules/, resolve: { extensions: [".js", ".jsx"] }, use: { loader: "babel-loader" } }, ] }