2020-04-19 16:38:07 +02:00
|
|
|
const devServerConfig = {
|
|
|
|
hot: true,
|
|
|
|
inline: true,
|
|
|
|
stats: {
|
|
|
|
children: false,
|
|
|
|
maxModules: 0
|
|
|
|
},
|
|
|
|
proxy: {
|
2020-04-19 18:14:44 +02:00
|
|
|
// proxies for the backend
|
2020-04-19 16:38:07 +02:00
|
|
|
'/api': 'http://localhost:3000',
|
2020-04-19 17:57:54 +02:00
|
|
|
'/uploads': 'http://localhost:3000',
|
2020-04-19 16:38:07 +02:00
|
|
|
'/ws-api': {
|
|
|
|
target: 'ws://localhost:3000',
|
|
|
|
ws: true,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function startFrontendDevServer(port) {
|
2020-04-19 17:18:38 +02:00
|
|
|
// require here to prevent prod dependency to webpack
|
|
|
|
const webpack = require("webpack");
|
|
|
|
const WebpackDevServer = require("webpack-dev-server");
|
|
|
|
const config = require("../config/webpack.dev");
|
|
|
|
|
2020-04-19 16:38:07 +02:00
|
|
|
new WebpackDevServer(webpack(config), devServerConfig)
|
|
|
|
.listen(port, (err) => {
|
|
|
|
if (err) {
|
|
|
|
console.log(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log("Listening on port " + port);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = startFrontendDevServer;
|