tr1s / tris-webpack-boilerplate

A Webpack boilerplate for static websites that has all the necessary modern tools and optimizations built-in. Score a perfect 10/10 on performance.
https://twbp.tris.codes/
MIT License
1.02k stars 97 forks source link

How to change to a different browser? #20

Closed I-keep-trying closed 5 years ago

I-keep-trying commented 5 years ago

I have been two days now trying to figure out how to test my simple static web page in a different non-default browser.

I know it's not using the browser configured in my editor, because I changed it there, and although it does fire up that browser, it doesn't call the webpack config files correctly, so I can't do it that way.

I tried adding the following to 'webpack.dev.js' and then to 'webpack.common.js' with no luck:

  devServer: {
    open: 'Internet Explorer',
  },

I may have the browser name wrong, I tried a lot of different guesses, but I don't think it matters because it just opens Chrome anyway, no matter what I put in there.

I also tried modifying the 'run' script in 'package.json' to include 'Internet Explorer' (and tried each of the other guesses) after the '--open' parameter, but no matter what I put there, I get an error saying Windows can't find it. I even tried 'Chrome' and got the same error, so that option just won't work at all.

How is the browser being determined? How can I change it?

tr1s commented 5 years ago

A bit of a strange question.

This is all usually handled by your browsers settings, so just go into the browsers settings that you want to make default, and then make that the default browser. Then next time you run npm start it will open up in that browser.

On top of that, when you run npm start, the URL can be used across different browsers. So if it opens it Chrome, copy the localhost:8080 link and past it into Safari and you'll have the exact same project opened.

I also tried

  devServer: {
    open: 'Google Chrome'
  }

with no luck, it just opens in Chrome still because that's my default browser.

Your best bet is to just copy the url and move it to the browser you want to test/dev in.

Hope this helps.