When the library gets used on top of a SharedWorker implemented as a worker program, the wrapping init function fails because document does not exist in the context of the worker.
The failing line in my case is hmr.js#L174 but L170 is going to have the same problem.
Adding a simple guard if (typeof document !== 'undefined') seems to solve the problem at least for me.
When the library gets used on top of a SharedWorker implemented as a worker program, the wrapping init function fails because
documentdoes not exist in the context of the worker.The failing line in my case is hmr.js#L174 but L170 is going to have the same problem.
Adding a simple guard
if (typeof document !== 'undefined')seems to solve the problem at least for me.