Skip to content

Commit

Permalink
archetype-react-app: Pass webpack-dev host and port (#157)
Browse files Browse the repository at this point in the history
This makes it so WEBPACK_HOST and WEBPACK_DEV_PORT are passed to the applicable parts of the application when starting up using `gulp dev`. Without this, it defaults to localhost and 2992 making it impossible to develop unless the developer has access to the local machine.
  • Loading branch information
ograycode authored and jchip committed Feb 9, 2017
1 parent 5ca236b commit 1d6a664
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions packages/electrode-archetype-react-app/arch-gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -499,23 +499,26 @@ INFO: Individual .babelrc files were generated for you in src/client and src/ser
task: mkCmd("webpack-dev-server",
`--config ${config.webpack}/webpack.config.dev.js`,
`--progress --colors`,
`--port ${archetype.webpack.devPort}`)
`--port ${archetype.webpack.devPort}`,
`--host ${archetype.webpack.devHostname}`)
},

"wds.hot": {
desc: "Start webpack-dev-server with Hot Module Reload",
task: mkCmd("webpack-dev-server",
`--config ${config.webpack}/webpack.config.hot.js`,
`--hot --progress --colors --inline`,
`--port ${archetype.webpack.devPort}`)
`--port ${archetype.webpack.devPort}`,
`--host ${archetype.webpack.devHostname}`)
},

"wds.test": {
desc: "Start webpack-dev-server in test mode",
task: mkCmd("webpack-dev-server",
`--config ${config.webpack}/webpack.config.test.js`,
`--progress --colors`,
`--port ${archetype.webpack.testPort}`)
`--port ${archetype.webpack.testPort}`,
`--host ${archetype.webpack.devHostname}`)
},

"test-server": () => [["lint-server", "lint-server-test"], "test-server-cov"],
Expand Down
2 changes: 1 addition & 1 deletion packages/electrode-archetype-react-app/config/archetype.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function loadDev() {
devPkg,
devRequire,
webpack: Object.assign({}, {
devHostname: "localhost",
devHostname: process.env.WEBPACK_HOST || "localhost",
devPort: getInt(process.env.WEBPACK_DEV_PORT, 2992),
testPort: getInt(process.env.WEBPACK_TEST_PORT, 3001),
modulesDirectories: []
Expand Down
4 changes: 2 additions & 2 deletions packages/electrode-react-webapp/lib/react-webapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ const setupOptions = (options) => {
serverSideRendering: true,
htmlFile: Path.join(__dirname, "index.html"),
devServer: {
host: "127.0.0.1",
port: "2992"
host: process.env.WEBPACK_HOST || "127.0.0.1",
port: process.env.WEBPACK_DEV_PORT || "2992"
},
paths: {},
stats: "dist/server/stats.json",
Expand Down

0 comments on commit 1d6a664

Please sign in to comment.