Esm: Possible to use inside Worker Threads?

Created on 3 Sep 2018  路  5Comments  路  Source: standard-things/esm

node: v10.9.0
esm: v3.0.80


Currently, when trying to use inside a node Worker Thread, I'm getting this error:

Error [ERR_INSPECTOR_NOT_AVAILABLE]: Inspector is not available
    at inspector.js:18:9
    at NativeModule.compile (internal/bootstrap/loaders.js:271:7)
    at Function.NativeModule.require (internal/bootstrap/loaders.js:164:18)
    at Function.Module._load (internal/modules/cjs/loader.js:517:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (.../node_modules/esm/esm.js:1:235108)
    at r (.../node_modules/esm/esm.js:1:602)
    at module.exports.e.exports (.../node_modules/esm/esm.js:1:798)
    at .../node_modules/esm/esm.js:1:808

I'm not very familiar with node loaders, but I'm assuming the Inspector is required for esm to work. Either way, figured I'd ask

bug

All 5 comments

Hi @chrisdothtml!

The last time I tried (which was when experimental workers was first released) esm did work. A bit has changed since then so I'll need to check again. Could you create a repro repo so I can take a look?

Was already working on it :)

https://github.com/chrisdothtml/esm-591

Okay, patched https://github.com/standard-things/esm/commit/76d9048e22f0957bfe6e49bd67e480b217a8b436. It turns out experimental workers + the inspector module don't work just yet. You can track progress at https://github.com/nodejs/node/issues/22676. I'll wrap loading of inspector in a try-catch for now which avoids the error.

Thank you for the quick fix!

v3.0.82 is released :tada:

Was this page helpful?
0 / 5 - 0 ratings