-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathwebpackDevServer.js
28 lines (26 loc) · 1.02 KB
/
webpackDevServer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const webpack = require("webpack");
const WebpackDevServer = require("webpack-dev-server");
const config = require("./webpack.config.dev");
const FRONTEND_PORT = 3000;
const BACKEND_PORT = 1337;
const colors = require("colors");
var server = new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
noInfo: true,
historyApiFallback: true,
proxy: {
"*": `http://localhost:${BACKEND_PORT}`
},
headers: {
"Access-Control-Allow-Origin": `http://localhost:${BACKEND_PORT}`
}
}).listen(FRONTEND_PORT, "localhost", function(err, result) {
if (err) console.log(err);
console.log("====================================".magenta);
console.log(" WEBPACK DEV SERVER ");
console.log("====================================".magenta);
console.log("Configuration:", "webpack.config.dev.js".magenta);
console.log("Listening at", `http://localhost:${FRONTEND_PORT}`.magenta);
console.log("====================================".magenta);
});