You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you may notice, only if globalThis.DOMException isn't defined would it then try to do all of the other work of including worker_threads and doing all the work.
And when i tried to load this via: import('https://jspm.dev/node-domexception')
then jspm felt like it also had to load additional dependencies (namely node:worker_threads, node:events):
Which for this module is completely useless inside other environment outside of NodeJS <17
I would have wised that the code that you shipped where compiled to something more like this top level await solution instead:
The reason we don't assume top-level await for these kinds of cases is because it would mean making the module async which is not a backwards compatible change in every case.
Since you are the library author here, my suggestion would be to modify your library approach to use the "imports" pattern:
Hi 👋
I maintain node-domexception and for curiosity i took a look at what some CDN deliveries did to my package and how it would transform it.
it's very small script with one conditional import of an optional
node:worker_threads
dependency.it goes like:
As you may notice, only if
globalThis.DOMException
isn't defined would it then try to do all of the other work of including worker_threads and doing all the work.And when i tried to load this via:
import('https://jspm.dev/node-domexception')
then jspm felt like it also had to load additional dependencies (namely
node:worker_threads
,node:events
):Which for this module is completely useless inside other environment outside of NodeJS <17
I would have wised that the code that you shipped where compiled to something more like this top level await solution instead:
(i'm thinking of doing this myself by converting my own package to ESM-only package and using top level await directly instead)
The text was updated successfully, but these errors were encountered: