Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(devserver): webpack-dev-server open new option type #3671

Merged
merged 4 commits into from
Apr 6, 2020

Conversation

EslamHiko
Copy link
Member

Documentation for this PR : webpack/webpack-dev-server#2492 in webpack dev server

@EslamHiko EslamHiko changed the title Webpackdev open option docs(devserver): webpack-dev-server open new option type Apr 2, 2020
@@ -844,6 +844,21 @@ module.exports = {
};
```

Sometimes you may want to use some options when opening the browser like opening an incognito window. In order to do that you can set `open` to an object. The object must have `app` property as an array. The first element in the array must be the browser name and the other following elements are the options you want. For example:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very abstract in the beginning. Need to make it more of a documentation level e.g. remove Sometimes... Say clearly what you can achieve or what is allowed when passing object to devServer.open.

Is app the only key allowed in this object?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about : If you want to use some switches when opening the browser like opening an incognito window (--incognito switch), you can set opento an object. The object must haveapp property as an array. The first element in the array must be the browser name and the other following elements are the switches you want. For example:

No, all options in https://www.npmjs.com/package/open will work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah its better! But, what i really dont like, is saying things like various some maybe potentially in the documentation. If you can get rid of that would be even better.

Another point is the word switches, could be arguments or options ? They are common to the notation --something in CLIs

Can you also add a sentence about that all the options from open can go inside the object, you can also include that link

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EugeneHlushko I think flags is the right word to use here, using arguments gives me the feeling that --something must have a value and options would cause confusion, It will be mixed by settings, the final result would be :

If you want to use flags when opening the browser like opening an incognito window (--incognito flag), you can set open to an object. The object accepts all open options, app property must be an array. The first element in the array must be the browser name and the other following elements are the options you want. For example:

webpack.config.js

module.exports = {
  //...
  devServer: {
    open: {
      app: ['Google Chrome','--incognito','--other-flag']
    }
  }
};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this sounds much better! Looks good, can you commit this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EugeneHlushko Check my last commit 😄

src/content/configuration/dev-server.md Show resolved Hide resolved
@EugeneHlushko EugeneHlushko merged commit c64609c into webpack:master Apr 6, 2020
@EugeneHlushko
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants