Skip to content

Hot reload doesn't work if webpack is running on different port than HTML page #170

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

Closed
glebtv opened this issue Apr 23, 2019 · 9 comments
Closed

Comments

@glebtv
Copy link

glebtv commented Apr 23, 2019

https://github.com/faceyspacey/extract-css-chunks-webpack-plugin/blob/master/src/hmr/hotModuleReplacement.js#L183

This checks makes CSS reload not work with webpack-dev-server running on a different port than the page.

Hot reload was working for me on v3.

Is there any way to override this check?

#161 is probably related

@ScriptedAlchemy
Copy link
Collaborator

Can you open a PR otherwise I’ll check in with webpack as it was added under their recommendations

@navaru
Copy link
Contributor

navaru commented May 16, 2019

Why was that line added? It breaks HMR on many webpack setups.

  // An URL is not an request if

  // 1. It's an absolute url
  if (/^[a-z][a-z0-9+.-]*:/i.test(url)) {
    return false;
  }

It doesn't make sense, cause an element.src will return the full URL:

<script defer async src="/0.js"></script>
// element.src -> https://domain.com/0.js

And on the other URLs normalizeURL is used.

@ScriptedAlchemy
Copy link
Collaborator

This was a recommendation from webpack based on alternative types of links being added. open a PR and ill address it

@ScriptedAlchemy
Copy link
Collaborator

thinking on it more, it had to do for scenarios where the URL started with a hash, or basically wasn't a real link that went somewhere. base64 for example.

You got a solution?

@navaru
Copy link
Contributor

navaru commented May 16, 2019

For me removing this condition // 1. It's an absolute url solves my problem. I can make a PR and remove it, is that ok?

@ScriptedAlchemy
Copy link
Collaborator

please do, I'm at work and legally cannot write the code, but I can merge yours.

Ill also raise this with Webpack directly as I maintain both mini-css and extract css.

@ScriptedAlchemy
Copy link
Collaborator

@ugin

@navaru
Copy link
Contributor

navaru commented May 18, 2019

PR created, I didn't bump the version, dunno what the policy is (some OS maintainers didn't like when the version is touched).

@ScriptedAlchemy
Copy link
Collaborator

No need to bump. We have system automation

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