More progress in webpack guides

This commit is contained in:
2021-04-08 09:05:11 -05:00
parent cf8885ed14
commit dcf99e5409
6 changed files with 3816 additions and 14 deletions

20
frontend/server.js Normal file
View File

@@ -0,0 +1,20 @@
const express = require('express');
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const app = express();
const config = require('./webpack.config.js');
const compiler = webpack(config);
// Tell express to use the webpack-dev-middleware and use the webpack.config.js
// configuration file as a base.
app.use(
webpackDevMiddleware(compiler, {
publicPath: config.output.publicPath,
})
);
// Serve the files on port 3000.
app.listen(3000, function () {
console.log('Example app listening on port 3000!\n');
});