Skip to content

Commit

Permalink
disable host check for devServer and fix host parsing (#168)
Browse files Browse the repository at this point in the history
* disable host check or devServer

* test for pathname

* update message

* update comment

* update config docs
  • Loading branch information
thescientist13 authored Aug 17, 2019
1 parent 02942ab commit 18161ae
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/cli/config/webpack.config.develop.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module.exports = ({ config, context, graph }) => {
devServer: {
port,
host,
disableHostCheck: true,
historyApiFallback: true,
hot: false,
inline: true
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/lifecycles/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ module.exports = readAndMergeConfig = async() => {

if (devServer.host) {
// eslint-disable-next-line max-depth
if (url.parse(devServer.host).hostname === null) {
reject(`Error: greenwood.config.js devServer host type must be a valid url, including http://. Passed value was: ${devServer.host}`);
if (url.parse(devServer.host).pathname === null) {
reject(`Error: greenwood.config.js devServer host type must be a valid pathname. Passed value was: ${devServer.host}`);
} else {
customConfig.devServer.host = devServer.host;
// console.log(`custom host provided => ${customConfig.devServer.host}`);
Expand Down
2 changes: 1 addition & 1 deletion test/cli/test-bed.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* workspace: path.join(process.cwd(), 'src'),
* devServer: {
port: 1984,
host: 'http://localhost'
host: 'localhost'
},
publicPath: '/'
* }
Expand Down
2 changes: 1 addition & 1 deletion www/pages/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = {
### Dev Server
Configuration for Greenwood's development server are available using the `devServer` option. Two options are available:
- `port`: Pick a different port when starting the dev server
- `host`: If you need to use a custom domain when developing locally (generally used along with editing an `/etc/hosts` file)
- `host`: If you need to use a custom domain (using [pathname](https://nodejs.org/api/url.html#url_url_pathname)) when developing locally and generally used along with editing an `/etc/hosts` file.

#### Example
```render js
Expand Down

0 comments on commit 18161ae

Please sign in to comment.