Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const express = require('express');
- const webpack = require('webpack');
- const path = require('path');
- const webpackConfig = require('../config/webpack.config');
- const config = {
- PORT: 8080
- };
- const compiler = webpack(webpackConfig);
- const server = express();
- server.use(
- require('webpack-dev-middleware')(compiler, {
- noInfo: true,
- publicPath: webpackConfig.output.publicPath
- })
- );
- server.use(require('webpack-hot-middleware')(compiler));
- server.get('*', function(req, res) {
- res.sendFile(path.join(__dirname, '/../index.html'));
- });
- // Prepare to receive requests.
- server.listen(config.PORT, err => {
- if (err) throw err;
- });
Add Comment
Please, Sign In to add comment