If you have a simple node.js app that serves HTML like this git repo for example:

git clone --depth=1 https://github.com/edwinaquino/nodejs-starter-app
code .
npm install

Then lets add a webpack server to be able to build the web app.

1. install the required dependencies:
$ npm i -D webpack-dev-server html-webpack-plugin webpack-cli webpack webpack-cli babel-loader @babel/core path

Create a webpack.config.js file
$ touch webpack.config.js

2. Open your webpack.config.js file and add the following:
HtmlWebPackPlugin = require('html-webpack-plugin')
plugins: [new HtmlWebPackPlugin()]

webpack.config.js should look something like this:

const path = require'path' );
const HtmlWebPackPlugin = require('html-webpack-plugin')
module.exports = {
    context: __dirname,
    entry: {
        index: './src/index.js',
        about: './src/about.js'
    output: {
        path: path.resolve__dirname'dist' ),
        filename: '[name].js',
    module: {
        rules: [
                test: /\.js$/,
                exclude: /node_modules/,
                use: 'babel-loader',
    plugins: [new HtmlWebPackPlugin()]

Open package.json and add the following under "scripts"

  "scripts": {
    "dev""webpack-dev-server --mode=development",
    "prod""webpack --mode=production",
    "test""echo \"Error: no test specified\" && exit 1",

Now you should be all set, run the following command to build your distribution and serve the file:

npm run dev