jaketrent / html-webpack-template

a better default template for html-webpack-plugin
MIT License
830 stars 139 forks source link

Avoid mutating mount IDs array when rendering single mount ID #38

Closed rafeememon closed 7 years ago

rafeememon commented 7 years ago

I'm running into some odd behavior when run in combination with webpack-dev-server. In my configuration I specify a single appMountId for a React app. When I run the dev server, the initial render is fine, but the div fixture appears an additional time whenever my scripts are recompiled and the template is rewritten, leading to something like:

...
<div id="fixture"></div>

<div id="fixture"></div>

<div id="fixture"></div>
...

This is because of an unshift call to the appMountIds array in the template. This PR fixes the problem by rendering appMountId separately and not mutating the array.

jaketrent commented 7 years ago

@rafeememon Great catch. Thank you!

jaketrent commented 7 years ago

Released in v5.5.1

rafeememon commented 7 years ago

Thanks @jaketrent!