2016-04-20 02:14:53 +00:00
|
|
|
import express from 'express';
|
|
|
|
import webpack from 'webpack';
|
|
|
|
import webpackDevMiddleware from 'webpack-dev-middleware';
|
|
|
|
import webpackHotMiddleware from 'webpack-hot-middleware';
|
2016-03-16 05:49:42 +00:00
|
|
|
|
2016-04-20 02:14:53 +00:00
|
|
|
import config from './webpack.config.development';
|
2016-03-22 18:20:05 +00:00
|
|
|
|
|
|
|
const app = express();
|
|
|
|
const compiler = webpack(config);
|
2016-04-07 01:11:16 +00:00
|
|
|
const PORT = 3333;
|
2016-03-22 18:20:05 +00:00
|
|
|
|
2016-04-20 02:14:53 +00:00
|
|
|
app.use(webpackDevMiddleware(compiler, {
|
2016-03-16 05:49:42 +00:00
|
|
|
publicPath: config.output.publicPath,
|
2016-08-15 17:04:36 +00:00
|
|
|
noInfo: true,
|
2016-04-20 02:14:53 +00:00
|
|
|
stats: {
|
|
|
|
colors: true
|
|
|
|
}
|
2016-03-22 18:20:05 +00:00
|
|
|
}));
|
|
|
|
|
2016-04-20 02:14:53 +00:00
|
|
|
app.use(webpackHotMiddleware(compiler));
|
2016-03-22 18:20:05 +00:00
|
|
|
|
|
|
|
app.listen(PORT, 'localhost', err => {
|
2016-03-16 05:49:42 +00:00
|
|
|
if (err) {
|
2016-04-20 02:14:53 +00:00
|
|
|
console.error(err);
|
2016-03-22 18:20:05 +00:00
|
|
|
return;
|
2016-03-16 05:49:42 +00:00
|
|
|
}
|
|
|
|
|
2016-03-22 18:20:05 +00:00
|
|
|
console.log(`Listening at http://localhost:${PORT}`);
|
2016-03-16 05:49:42 +00:00
|
|
|
});
|