const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const CleanWebpackPlugin = require('clean-webpack-plugin'); const webpack = require('webpack'); const outputDirectory = 'dist/public'; module.exports = { entry: { app: './src/client/index.js', }, plugins: [ new CleanWebpackPlugin(['dist']), new HtmlWebpackPlugin({ title: 'Mapping Manuscript Migrations – A Digging into Data project for 2017-2019', // Load a custom template template: 'src/client/index.html', }), new webpack.NamedModulesPlugin(), new webpack.HotModuleReplacementPlugin() ], output: { filename: '[name].bundle.js', path: path.resolve(__dirname, outputDirectory), }, module: { rules: [ { test: /\.m?js$/, exclude: /node_modules/, use: ['babel-loader'] }, { test: /\.css$/, use: [ 'style-loader', 'css-loader', ], }, { test: /\.(png|svg|jpg|gif)$/, use: [ 'file-loader', ], }, ], }, resolve: { extensions: ['.js', '.jsx'], }, };