Using dynamic import with npm compatibility gives intermittent error "__DENO_NODE_GLOBAL_THIS_167935
This is pretty hard to google because the number at the end of the error changes everytime it happens, but basically: is this a known issue? I'll run some code (in a worker, using dynamic import pointing to
npm:
or a CDN and get ReferenceError: __DENO_NODE_GLOBAL_…
on the first and sometimes second run, but after that it'll work.5 Replies
@tmcw that's definitely a bug! Could you provide some kind of reproduction?
I have a feeling I know what's the issue, but I need a test case to pin point it
Sure, I think I can do that
Okay! Quick repro: https://gist.github.com/tmcw/9f39ba99550bf65bfbd23d560dbcf786
This produces
okay, works for dynamic & static imports - the importing from a data url appears to be the cause
tracked the internals down to https://github.com/denoland/deno/blob/7d9653d51fb0c4d3844f61e1214b6bddc50d2cef/ext/node/lib.rs#L401 - not like that's the cause
okay i think i found a workaround - if you import something from npm on the top level before you import something from npm in an import, then it works
filed a bug with the repro: https://github.com/denoland/deno/issues/18343
thanks! yeah, that was exactly what I expected - we only initialize the node runtime if we discover the NPM dependency but data URLs were definitely missed on this
I'll try to fix it before tomorrow's release, but no promises 🤞