From 1e4ad53196d1f43c66215264c371368bac991b10 Mon Sep 17 00:00:00 2001 From: Tomasz Knapik <hi@tmkn.org> Date: Wed, 9 Jan 2019 15:08:33 +0000 Subject: [PATCH] Fix React dev server not serving outside VM --- Vagrantfile | 1 + gulpfile.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 3380da83a..ddac713ee 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -33,6 +33,7 @@ Vagrant.configure(2) do |config| # within the machine from a port on the host machine. In the example below, # accessing "localhost:8000" will access port 8000 on the guest machine. config.vm.network "forwarded_port", guest: 8000, host: 8000, id: "webserver" + config.vm.network "forwarded_port", guest: 3000, host: 3000, id: "reactserver" # Create a private network, which allows host-only access to the machine # using a specific IP. diff --git a/gulpfile.js b/gulpfile.js index 85ed64030..57304ec0e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -256,7 +256,7 @@ gulp.task('watch:app', function watch (callback) { serverOptions ) - server.listen(3000, "localhost", function(err) { + server.listen(3000, "0.0.0.0", function(err) { if(err) throw new console.PluginError("webpack-dev-server", err); // Server listening console.log("[webpack-dev-server]", "Running"); -- GitLab