Skip to content

hot module replacement dont work with absolute publicPath #25

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
lutzk opened this issue Jul 16, 2017 · 6 comments
Closed

hot module replacement dont work with absolute publicPath #25

lutzk opened this issue Jul 16, 2017 · 6 comments

Comments

@lutzk
Copy link

lutzk commented Jul 16, 2017

when hot updating the plugin takes the current protocol + host + port + publicPath + outputFilename

https://github.com/faceyspacey/extract-css-chunks-webpack-plugin/blob/master/hotModuleReplacement.js#L3
https://github.com/faceyspacey/extract-css-chunks-webpack-plugin/blob/master/hotModuleReplacement.js#L4

so the check in https://github.com/faceyspacey/extract-css-chunks-webpack-plugin/blob/master/hotModuleReplacement.js#L13
oldChunk === newChunk is always false:

oldChunk = http://localhost:3011/dist/assets/Login
newChunk = http://localhost:3010http://localhost:3011/dist/assets/Login

when i comment out the origin it works

there could be a check for if the publicPath is an absolute one and just add the origin if its not

should i send i pr for this?

@faceyspacey
Copy link
Owner

most definitely. would appreciate the PR. thanks!

@faceyspacey
Copy link
Owner

This PR from @phyllisstein may do the trick:

#24

it just came in. I'll be reviewing these Issues fully on Monday.

@lutzk
Copy link
Author

lutzk commented Jul 16, 2017

i checked #24
i havent tested but i think it wont fix that issue here as

the newHref is still newHref = origin + publicPath + outputFilename

@phyllisstein
Copy link
Contributor

phyllisstein commented Jul 16, 2017

If I understand the issue correctly, I think this commit to #24 should resolve it: c86dfac. The URL constructor accepts a base URL as its second parameter; the change assumes that any publicPath that includes a protocol string is a valid base URL and passes it to the new URL, or uses window.location as the base if a protocol is missing.

@lutzk
Copy link
Author

lutzk commented Jul 16, 2017

yes looks like it would fix my issue
but looks like if publicPath.match(/https?:/g) is false you lost the publicPath ?
i left a comment at c86dfac
thank you

@faceyspacey
Copy link
Owner

@phyllisstein PR fixing this and related issues has been merged. yarn upgrade extract-css-chunks-webpack-plugin. Thanks again @phyllisstein !!

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