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

Doesn't reload the browser after re-compiling #8

Closed
okonet opened this issue Mar 18, 2014 · 6 comments
Closed

Doesn't reload the browser after re-compiling #8

okonet opened this issue Mar 18, 2014 · 6 comments

Comments

@okonet
Copy link

okonet commented Mar 18, 2014

I'm not sure it's a bug but I'm trying to switch from watch-build cycle to using of connect + middleware. The only problem is that after recompiling the bundle browser doesn't reload it. If I do manual refresh I can see an updated bundle. Please advise where I can look for it.

@sokra
Copy link
Member

sokra commented Mar 18, 2014

@sokra sokra closed this as completed Mar 18, 2014
@sokra
Copy link
Member

sokra commented Mar 18, 2014

@okonet
Copy link
Author

okonet commented Mar 18, 2014

This doesn't answer my question... I know there is webpack-dev-server and I know how to configure & start it. The problem is, I'm using grunt-connect as a web-server for several reasons and I'd like to have webpack-dev-server running along with connect using middleware. Is it possible to have live reload in this case or not?

@sokra
Copy link
Member

sokra commented Mar 18, 2014

Not this way, but in another way.

The webpack-dev-server has a configuration option to wrap another server. Just set contentBase to your url.

Example:

  • grunt-connect on port 8081.
  • grunt-webpack: webpack-dev-server on port 8080 with contentBase = "http://localhost:8081".
  • http://localhost:8080/webpack-dev-server/index.html (live reloading)
  • http://localhost:8080/index.html or http://localhost:8081/index.html (not live reloading)

@okonet
Copy link
Author

okonet commented Mar 19, 2014

Thanks! This helps a lot.

@vincentpalita
Copy link

vincentpalita commented Jun 21, 2017

I found a way to do that with browsersync by simulating how the webpack-hot-middleware plugin works.
Inside your rewriteRules you can add:

const browser = browserSync.create()
const config = webpack(webpackConfig);
config.plugin('done', () => {
    try {
        browser.reload();
    } catch (e) {
    }
})

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

3 participants