Closed codingjoe closed 7 months ago
Ideally the library would just be rewritten into ESM and compiled down to UMD via rollup - easy enough. Then publish both versions in the npm package.
Considering that this library was last updated 4 years ago: the maintainer doesn't care obviously.
However, I care and please fork this repository and do what I just said. I will watch your fork and if you run into issues, you can ping me - I just happen to need this aswell.
If you don't now rollup good enough yet, you can take the build script of PlayCanvas as good/tested example.
While you are at it, you can also add proper JSDoc comments to document the code.
After a little research, why would anyone care, since WakeLock
has been implemented?
Mainly as polyfill for testing e.g. Cardboard VR on old browsers.
Hi there 👋,
Thanks for maintaining such a wonderful package <3
We are transitioning to ESM over bundling. While doing so, I noticed that this package wasn't set up correctly.
The
package.json
module
key points tosrc/index.js
. https://github.com/richtr/NoSleep.js/blob/1d15cc88dd8c1b62fe5b5f910c6ff7396b280d68/package.json#L16However, the
index.js
file is written in CommonJS at does arequire
call in the very first line. https://github.com/richtr/NoSleep.js/blob/1d15cc88dd8c1b62fe5b5f910c6ff7396b280d68/src/index.js#L1Furthermore, the
module
key, is deprecated in favor of definingexports
. Finally, both,module
andexports
should usually point to the distribution code, not the package sources.I am happy to provide a fix that transforms this package to be fully ESM compatible. Please let me know if you'd be interested in a contribution.
Cheers! Joe