Skip to content
This repository has been archived by the owner on Jan 11, 2019. It is now read-only.

Commit

Permalink
Merge branch 'brysgo-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rick committed Aug 4, 2015
2 parents 32a0b10 + 530eb48 commit 6e9f719
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import Transmit from "react-transmit";
import routes from "views/Routes";
import url from "url";

var hostname = process.env.HOSTNAME || "localhost";

/**
* Start Hapi server on port 8000.
*/
const server = new Server();
server.connection({port: process.env.PORT || 8000});
server.connection({host: hostname, port: process.env.PORT || 8000});
server.start(function () {
console.info("==> ✅ Server is listening");
console.info("==> 🌎 Go to " + server.info.uri.toLowerCase());
Expand Down Expand Up @@ -71,7 +73,7 @@ server.ext("onPreResponse", (request, reply) => {
</html>`
);

const webserver = process.env.NODE_ENV === "production" ? "" : "//localhost:8080";
const webserver = process.env.NODE_ENV === "production" ? "" : "//" + hostname + ":8080";
output = Transmit.injectIntoMarkup(output, reactData, [`${webserver}/dist/client.js`]);

reply(output);
Expand Down
10 changes: 6 additions & 4 deletions webpack.client-watch.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
var webpack = require("webpack");
var config = require("./webpack.client.js");

var hostname = process.env.HOSTNAME || "localhost";

config.cache = true;
config.debug = true;
config.devtool = "eval";

config.entry.unshift(
"webpack-dev-server/client?http://localhost:8080",
"webpack-dev-server/client?http://" + hostname + ":8080",
"webpack/hot/only-dev-server"
);

config.output.publicPath = "http://localhost:8080/dist/";
config.output.publicPath = "http://" + hostname + ":8080/dist/";
config.output.hotUpdateMainFilename = "update/[hash]/update.json";
config.output.hotUpdateChunkFilename = "update/[hash]/[id].update.js";

Expand All @@ -28,7 +30,7 @@ config.module = {
};

config.devServer = {
publicPath: "http://localhost:8080/dist/",
publicPath: "http://" + hostname + ":8080/dist/",
contentBase: "./static",
hot: true,
inline: true,
Expand All @@ -37,7 +39,7 @@ config.devServer = {
noInfo: false,
headers: {"Access-Control-Allow-Origin": "*"},
stats: {colors: true},
host: "0.0.0.0"
host: hostname
};

module.exports = config;

0 comments on commit 6e9f719

Please sign in to comment.