statianzo / webpack-livereload-plugin

LiveReload during webpack --watch
ISC License
204 stars 51 forks source link

Multiple instances of livereload #48

Closed aaronalderman closed 6 years ago

aaronalderman commented 6 years ago

I have a particular use case where I require two separate webpack services watching different sets of files however I cannot use live reloading for both services even when the port number is different.

Both scripts are being injected (through the appendScriptTag option) however due to a check for an existing id (webpack-livereload-plugin-script), the second fails to load.

var id = "webpack-livereload-plugin-script";
if (document.getElementById(id)) { return; }

Could the id be another configuration item, or could a random string be appended to the id per instance?

statianzo commented 6 years ago

Random id per plugin instance sounds like a good idea to me. Something like webpack-livereload-plugin-abc123. Feel free to submit a PR and I'll get it merged in.