const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); module.exports = { entry: { index: path.resolve(__dirname, 'src', 'index.js'), }, plugins: [ new HtmlWebpackPlugin({ title: 'Example Webapp', template: path.resolve(__dirname, 'src', 'index.html'), }), ], output: { clean: true, filename: '[name].bundle.js', path: path.resolve(__dirname, 'dist'), }, module: { rules: [ // sass support with `import './styles.scss'` { test: /\.s[ac]ss$/i, use: ['style-loader', 'css-loader', 'sass-loader'], }, // css support with `import './styles.css'` { test: /\.css$/i, use: ['style-loader', 'css-loader'], }, // image support with `import Image from './image.png'` { test: /\.(png|svg|jpg|jpeg|gif)$/i, type: 'asset/resource', }, ], }, };