insomnia/webpack/server.js
Gregory Schier 6a7a0b07bc try
2016-08-23 12:43:01 -07:00

30 lines
646 B
JavaScript

import express from 'express';
import webpack from 'webpack';
import webpackDevMiddleware from 'webpack-dev-middleware';
import webpackHotMiddleware from 'webpack-hot-middleware';
import config from './webpack.config.development.babel';
const app = express();
const compiler = webpack(config);
const PORT = 3333;
app.use(webpackDevMiddleware(compiler, {
publicPath: config.output.publicPath,
noInfo: true,
stats: {
colors: true
}
}));
app.use(webpackHotMiddleware(compiler));
app.listen(PORT, 'localhost', err => {
if (err) {
console.error(err);
return;
}
console.log(`Listening at http://localhost:${PORT}`);
});