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
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:
Open package.json and add the following under "scripts"
Now you should be all set, run the following command to build your distribution and serve the file:
npm run dev