const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const path = require('path');
filename: '[name]-[contenthash].bundle.js',
path: path.resolve(__dirname, '../dist'),
// Replace previously-compiled files with latest one on each build
// Name this file main so it does not get automatically requested as a static file
template: path.resolve(__dirname, '..', 'src', 'main.html'),
new MiniCssExtractPlugin(),
// Regex to decide which files to run Babel on
test: /\.(js|mjs|jsx)$/, // CHANGE HERE: jsx added
// CHANGE HERE: ensure @babel/preset-react
presets: ['@babel/preset-env', '@babel/preset-react'],
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],