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

devserver shall be capable to open app not only in default system browser #2960

Closed
jerome-mare opened this issue Jan 8, 2019 · 11 comments
Closed
Milestone

Comments

@jerome-mare
Copy link

jerome-mare commented Jan 8, 2019

Issue to solve

When using the quasar-cli to launch the dev server, it opens the operating system default browser.

Feature requested

It will be interesting to be able to launch the browser of our choice with specific command line option. For example Google canary in incognito mode.

Proposed technical solution

opn is able to handle that scenario : https://github.com/sindresorhus/opn#readme
opn('https://localhost:8080/', {app: ['google canary', '--incognito']});

With quasar-cli, it will be possible to enhance the source file dev-server.jsto pass the option to opn

function openBrowser (url, options = {} ) {
  const opn = require('opn')
  opn(url, options)
}

// ....

 if (cfg.devServer.open && ['spa', 'pwa'].includes(cfg.ctx.modeName)) {
          const browser = cfg.devServer.browser || {} 
          openBrowser(cfg.build.APP_URL, browser)
  }

In this case, with the option browser of the devServer section, we can define the target browser, for example : {app: ['google canary', '--incognito']}

@rstoenescu
Copy link
Member

Will do.

@rstoenescu rstoenescu added this to the v1.0 milestone Jan 8, 2019
@rstoenescu
Copy link
Member

Would you mind making a PR for this with your solution?

@jerome-mare
Copy link
Author

I'm working on it but it don't seems to work the opn call in dev-server.js (function openBrowser - line 11) seems to be never called.

Will I do a PR on documentation website too to explain the option ?

rstoenescu added a commit that referenced this issue Mar 4, 2019
@rstoenescu
Copy link
Member

Sorry it took so long. Lots going on. Available in beta.10.

Using open prop to open with a specific browser and not with the default browser of your OS:

// quasar.conf.js

devServer: {
  open: 'firefox'
}

@jerome-mare
Copy link
Author

Sorry, the pull request is here quasarframework/quasar-cli#220.
The issue was related with the quasar-cli and not quasar, my mistake

@rstoenescu
Copy link
Member

Hi,

Can you instead port 4636d3a and test it out on legacy 0.17 quasar-cli?

Currently dealing with 1.0 stuff. Sorry for the inconvenience.

@rstoenescu
Copy link
Member

Assuming you want it for 0.17?

@jerome-mare
Copy link
Author

Hi,
I don't need it for 0.17. I can wait for the v1 stable.
But there was a feature in my pull request that is not in your commit.
The feature is to pass command line parameters to the target browser.
Can you integrate this too in quasar-cli v1 ?

I'm testing quasar v1 in a new side project for a week. It's a great work ! thank you !

@rstoenescu
Copy link
Member

Sure it is.

devServer: {
open: 'firefox'
}

or open: { .... }

@jerome-mare
Copy link
Author

Sorry, i cannot make it work (cf. screenshoot)

Capture d’écran 2019-03-11 à 14 29 19

I remember that it was not possible to pass an object to open property and i finally use the property "browser" of the "devServer" section. I think that webpack-dev-server cannot pass object to opn component,but i don't really remember why. All is in my pull request. If you want i can create a new PR on quasar v1

@rstoenescu
Copy link
Member

@jerome-mare open: ['google chrome'] --> no need to wrap it with { app: [....] }

mesqueeb pushed a commit to mesqueeb/quasar that referenced this issue Feb 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants