simple-web-worker icon indicating copy to clipboard operation
simple-web-worker copied to clipboard

not failing in module scope when run in node

Open antialias opened this issue 4 years ago • 3 comments

For universal (a.k.a. "isomorphic") rendering: Even though this is a web-only module, it's important to not fail when imported server-side, because sometimes that's where components get rendered.

antialias avatar Feb 07 '21 19:02 antialias

Hi @antialias!

First of all, I am so truly sorry for the long hiatus on this project!

Thank you for your contribution!

As far as I know, Node has a worker_threads module that has been stable since 12.x. This package is not intended to be used on node, only on web environments. So, why use this package over the native node one?

israelss avatar Aug 21 '21 14:08 israelss

why use this package over the native node one?

For rendering the components server-side. Even if it doesn't make sense to use a web worker on the server, it's important to not break the process when importing this module in a node environment.

antialias avatar Aug 21 '21 15:08 antialias

why use this package over the native node one?

For rendering the components server-side. Even if it doesn't make sense to use a web worker on the server, it's important to not break the process when importing this module in a node environment.

This makes sense. ~It's amazing how narrow our vision and thoughts can be sometimes, isn't?~ 😅

Anyway, can you please add something to the README file to point out this use possibility, and perhaps some example case?

israelss avatar Aug 22 '21 01:08 israelss