Boilerplate code for running webpack app inside nodejs (you need to install webpack-dev-middleware
in your app as devDependencies). #webpack #nodejs
const express = require('express');
/**
* we need to make use of all 3 to make webpack work
*/
const webpackMiddleware = require('webpack-dev-middleware'); //this only serves to intercept the incoming requests and handle webpack
const webpack = require('webpack'); //this exists to compile all of our application assets
const webpackConfig = require('./webpack.config.js'); //this instructs on how to run webpack correctly with configurations
/**END */
const app = express();
app.use(webpackMiddleware(webpack(webpackConfig)));
app.listen(3050, () => console.log('listening...'));