2016-03-22 18:20:05 +00:00
|
|
|
'use strict';
|
2016-03-16 05:49:42 +00:00
|
|
|
|
2016-03-22 18:20:05 +00:00
|
|
|
const express = require('express');
|
|
|
|
const webpack = require('webpack');
|
|
|
|
const config = require('../webpack/dev.config');
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
app.use(require('webpack-dev-middleware')(compiler, {
|
2016-03-16 05:49:42 +00:00
|
|
|
publicPath: config.output.publicPath,
|
2016-03-22 18:20:05 +00:00
|
|
|
stats: {colors: true}
|
|
|
|
}));
|
|
|
|
|
|
|
|
app.use(require('webpack-hot-middleware')(compiler));
|
|
|
|
|
|
|
|
app.listen(PORT, 'localhost', err => {
|
2016-03-16 05:49:42 +00:00
|
|
|
if (err) {
|
2016-03-22 18:20:05 +00:00
|
|
|
console.log(err);
|
|
|
|
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
|
|
|
});
|