2015-10-29 08:33:21 +03:00
|
|
|
const path = require('path');
|
|
|
|
const express = require('express');
|
2015-10-23 11:11:40 +03:00
|
|
|
const webpack = require('webpack');
|
2016-11-05 14:23:32 +03:00
|
|
|
const internalIp = require('internal-ip');
|
2015-10-23 11:11:40 +03:00
|
|
|
const config = require('./webpack.config.development');
|
|
|
|
|
2015-10-29 08:33:21 +03:00
|
|
|
const app = express();
|
|
|
|
const compiler = webpack(config);
|
|
|
|
|
|
|
|
app.use(require('webpack-dev-middleware')(compiler, {
|
2016-06-04 17:36:17 +03:00
|
|
|
noInfo: true,
|
|
|
|
publicPath: config.output.publicPath,
|
2015-10-23 11:11:40 +03:00
|
|
|
stats: {
|
2017-01-26 20:05:32 +03:00
|
|
|
colors: true,
|
|
|
|
},
|
2015-10-29 08:33:21 +03:00
|
|
|
}));
|
|
|
|
|
|
|
|
app.use(require('webpack-hot-middleware')(compiler));
|
|
|
|
|
2017-01-26 20:05:32 +03:00
|
|
|
app.get('*', (req, res) => {
|
2016-06-04 17:36:17 +03:00
|
|
|
res.sendFile(path.join(__dirname, './spec/index.html'));
|
2015-10-29 08:33:21 +03:00
|
|
|
});
|
|
|
|
|
2016-11-05 14:23:32 +03:00
|
|
|
const port = 8080;
|
|
|
|
const ip = internalIp.v4();
|
|
|
|
|
|
|
|
app.listen(port, (err) => {
|
2016-06-04 17:36:17 +03:00
|
|
|
if (err) {
|
|
|
|
console.log(err);
|
|
|
|
return;
|
|
|
|
}
|
2015-10-29 08:33:21 +03:00
|
|
|
|
2016-11-05 14:23:32 +03:00
|
|
|
console.log(' --------------------------------------');
|
|
|
|
console.log(` Local: http://0.0.0.0:${port}`);
|
|
|
|
console.log(` External: http://${ip}:${port}`);
|
|
|
|
console.log(' --------------------------------------');
|
2015-10-23 11:11:40 +03:00
|
|
|
});
|