webpack-hot-middleware icon indicating copy to clipboard operation
webpack-hot-middleware copied to clipboard

Fix possible double slashs when dynamicPublicPath

Open mathieutu opened this issue 5 years ago • 4 comments

This PR contains a:

  • [x] bugfix
  • [ ] new feature
  • [ ] code refactor
  • [ ] test update
  • [ ] typo fix
  • [ ] metadata update

Motivation / Use-Case

Hi, Thanks for this package!

I'm in a situation where a tool I can't control set my publicPath from config, and add a / to it. In fact webpack recommends to do that:

The value of the option is prefixed to every URL created by the runtime or loaders. Because of this the value of this option ends with / in most cases.

However the HMR path also starts with a /, and all the default paths and example of this package!

With theses both slashes, when in case of dynamicPublicPath: true, we end to a publicPath//path path.

This little PR just fixes that by replacing all // with / in the paths concatenation.

Thanks, Mathieu.

mathieutu avatar May 05 '20 15:05 mathieutu

CLA assistant check
All committers have signed the CLA.

jsf-clabot avatar May 05 '20 15:05 jsf-clabot

Circle fails for a reason which seems not related to this PR.

mathieutu avatar May 05 '20 15:05 mathieutu

@mathieutu Sorry for delay, can you add test case?

alexander-akait avatar Nov 07 '22 20:11 alexander-akait

Sorry, but it has been more than two years, and I'm not using the project anymore.

I'll try to take a look, but if someone wants to tackle it, feel free!

mathieutu avatar Nov 09 '22 13:11 mathieutu