odin-codespace/dom-exercise/webpack-demo/server.js

18 lines
423 B
JavaScript
Raw Normal View History

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);
app.use(
webpackDevMiddleware(compiler, {
publicPath: config.output.publicPath,
})
);
app.listen(3000, function () {
console.log('Example app listening on port 3k');
});