2020-04-19 16:38:07 +02:00
|
|
|
const devServerConfig = {
|
2020-05-09 15:40:26 +02:00
|
|
|
hot: true,
|
|
|
|
inline: true,
|
|
|
|
stats: {
|
|
|
|
children: false,
|
|
|
|
maxModules: 0,
|
|
|
|
},
|
|
|
|
proxy: {
|
|
|
|
// proxies for the backend
|
|
|
|
"/api": "http://localhost:3000",
|
|
|
|
"/uploads": "http://localhost:3000",
|
|
|
|
"/ws-api": {
|
|
|
|
target: "ws://localhost:3000",
|
|
|
|
ws: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2020-04-19 16:38:07 +02:00
|
|
|
|
|
|
|
function startFrontendDevServer(port) {
|
2020-05-09 15:40:26 +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 17:18:38 +02:00
|
|
|
|
2020-05-09 15:40:26 +02:00
|
|
|
new WebpackDevServer(webpack(config), devServerConfig).listen(port, (err) => {
|
|
|
|
if (err) {
|
|
|
|
console.log(err);
|
|
|
|
}
|
2020-04-19 16:38:07 +02:00
|
|
|
|
2020-05-09 15:40:26 +02:00
|
|
|
console.log("Listening on port " + port);
|
2020-04-19 16:38:07 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = startFrontendDevServer;
|