const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const webpack = require('webpack'); module.exports = { entry: './frontend/main.jsx', output: { path: path.resolve(__dirname, 'static/build'), filename: 'index.js', }, module: { rules: [ { test: /\.css$/i, use: ['style-loader', 'css-loader'], }, { test: /\.(png|svg|jpg|jpeg|gif)$/i, type: 'asset/resource', }, { test: /\.(js|jsx)$/, exclude: /node_modules/, use: { loader: 'babel-loader', options: { presets: ['@babel/preset-env', '@babel/preset-react'], }, }, }, ], }, plugins: [ new HtmlWebpackPlugin({ template: './templates/index.html', }), new webpack.DefinePlugin({ 'process.env.API_URL': JSON.stringify(process.env.API_URL || 'http://localhost:8000/'), }), ], devServer: { static: './assets', hot: true, historyApiFallback: true, allowedHosts: 'all', }, };