-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Add BrowserSync #1024
Add BrowserSync #1024
Conversation
c55e522
to
ccf636f
Compare
I havent used browserSync much. What is the advantage/difference between it and react-hot-reloader? |
ccf636f
to
d07da62
Compare
Provides a nice dashboard, single-click to reload page on all devices, indicator when your pages get disconnected/reconnected from network, keep page navigation and scrolling in sync across all the browsers, etc. I suggest to try out to get a feel of it. |
Also syncs clicks across devices, so you click a button on one of them and it does the same on all others. Same thing for form input. |
Also visual CSS outlining, network throttling, remote debugging. Throttling kinda shows that this boilerplate isn't usable below 4G. Didn't try the remote debugging. |
You arent running production built code when you run the It is only worth using the network throttling when running production built code. This boilerplate is totally usable below 4G. |
OK, good to know. With more work then maybe browserSync could be launched for either dev or prod. |
The main value I get from ngrok is the ability easy share work in development with clients and colleagues across the internet. I would not want to lose that ability. |
@gihrig |
@sedubois I never tied it. Your remark (quoted above) led me to believe that it would not. Can you explain more about the differences between ngrok and localtunnel? Why/how does localtunnel not work with your VPN? |
With my VPN enabled, localtunnel doesn't work whereas ngrok does. But I suspect not many people have such a setup? With VPN disabled, localtunnel works fine, I can access my machine from the internet. OTOH as mentioned, localtunnel is integrated within browserSync's dashboard, and allows custom subdomains, which can be handy when sharing URLs with clients. In ngrok, this is a paid feature. Note that I'm not fully familiar with either of these tunnel providers. I casually used ngrok in the past and recently discovered localtunnel as it is provided within browserSync. |
Note that PR's should be made to the |
Note: #894 will probably be merged, so this is probably not a concern at this point. I have never personally used BrowserSync, so I'll have to play with it and see what it feels like. (not sure when I have the time, but I'll try to soon! Currently on vacation in 🗽) Question: Does this replace hot reloading? |
Hot reloading is a more modern solution for updating the UI's during development. They can't save state. Instead, they reload the entire page. Its impossible to not lose the state if the page is reloaded. |
I think closing this was a bit premature, BrowserSync does have value. Contrary to hot-reloading, it syncs button clicks and interactions across pages, which makes cross-device testing very easy and quick. The question I have if those two techniques could be used alongside each other, or if they're completely separate? |
d07da62
to
44fdfd4
Compare
@mxstbr browserSync can be configured (as in this PR) to proxy webpack, the latter then handling hot reloading. https://github.com/Browsersync/recipes/tree/master/recipes/webpack.react-hot-loader |
44fdfd4
to
d816348
Compare
So, essentially, the only difference here to the current version is that if you open the webpage on multiple devices at the same time, all the interactions sync, do I have that right? If so, that's pretty cool I think 😊 |
@mxstbr yes 😊 plus some nice-to-have tools like CSS outlining, remote debug, network throttling. And I switched tunnelling from ngrok to browserSync's, but that part isn't required, could be rolled back. |
d816348
to
5939f37
Compare
I like the code I've seen (though I haven't done an in-depth review yet), the thing that's holding me back here is that I haven't tested this yet so I'm not sure how awesome this is. I'm pretty busy at the moment, so if somebody who's never used BrowserSync could try this out and report back how useful it is that'd be amazing! |
5939f37
to
79b6e8b
Compare
ee6a76a
to
aace146
Compare
I've never used browsersync before, so I took this opportunity to test it out. I ran the app in a couple of browser sessions, as well as on my Nexus phone and the syncing works great. The combination of browsersync with HMR makes for a great developer experience. Especially if you target phones, as you can navigate it remotely from your desktop. note: I am using cloud9 ide, so I had to add these lines since c9 only allows for ports 8080, 8081 and 8082. With this setup you get HMR at 8080, browsersync+HMR at 8081 and the browsersync dashboard at 8082. |
@GGAlanSmithee thanks, I updated the code to set up ports correctly even when changing the default. Feel free to try again. |
@sedubois tested again with your changes and got error
this happends because Other than that, this is working as expected 👍 |
5f4df77
to
03e3c7b
Compare
Thanks @GGAlanSmithee, I fixed again :) |
About hot reloading, please read this comment gaearon/react-hot-boilerplate#97 (comment) and the priorities are
I came here as well to switching back from hot reloading to browser-sync. or it could be how it is done without BrowserSync |
@bsr203 thanks for linking to that issue, that is interesting indeed. Hopefully they will integrate this with react some time in the future and hide it under a development flag, much like propTypes checks are done. Do you know if browser-sync can fully replace hmr? |
@GGAlanSmithee to be honest, I am planning to move away from A talk by the author: https://www.youtube.com/watch?v=Pj-RakjfHDI#t=33m15s They also have a hot reloading example. gonna try it today. |
b945565
to
73997b6
Compare
So AFAIK, this browserSync works quite great with the exception of keyboard events. E.g in the example app there's a So not for me to say if that's a blocker. Just noting that BrowserSync is still "pretty" popular, 1 million package downloads per month. BrowserSync has other features e.g override locally the contents of a remote website, CSS outlining, network throttling, etc. Maybe in the future Webpack can offer all that. |
Just got a reply from BrowserSync: they intend to improve keyboard syncing (no time frame specified). |
To be honest, I don't think I really want to merge something by default that doesn't even work for the tiny example app. That being said, I definitely see the value of BrowserSync, so when things improve on this front I'd love to add it in the future! Thanks for this great reference PR, sorry for the slow response here! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Just noting that besides adding the basic browserSync functionalities, this switches tunnelling from ngrok to browserSync's built-in feature (uses
localtunnel
), whose behaviour might be slightly different. For example localtunnel doesn't work with my VPN, but OTOH it allows the tunnel to be nicely integrated within browserSync's dashboard, and the tunnel's URL can be configured for free.If agreed and if wanting to clean up, ngrok could be removed altogether, which would require updating
pagespeed.js
(need to launch server, wait for browserSync init, then pass tunnel URL to PageSpeed Insights).