webpack.config.js
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: process.env.NODE_ENV || 'development',
module: {
rules: [
{
test: /\.js$/,
enforce: 'pre',
use: ['source-map-loader'],
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader',
],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: 'index.html',
}),
],
devServer: {
contentBase: path.join(__dirname, 'dist'),
port: 8080,
},
};