I noticed this some time ago, but didn't follow up on it. not sure if my expectations are correct and the following should work:
repro:
// index.js
console.log('test')
node index.js # works
node -r esm index.js # works
ndb -r esm . # works
ndb -r esm ./index.js # works
ndb -r esm index.js # Error: Cannot find module 'index.js'
# same with chrome dev tools (used by `ndb` I believe)
node --inspect-brk index.js # works
node -r esm --inspect-brk index.js # Error: Cannot find module 'index.js'
tested with latest patch of v3.0.x, 3.1.x, and v3.2.x
Hi @dnalborczyk!
This looks like a bug in Node 11.4.0+. It happens regardless of what the preload script is.
I've reported it and will ping back when it's resolved.
thank you!
Good news!
I narrowed the problem Node commit down and the committer has been notified for review.
oh, nice! awesome! thank you @jdalton !
More news. It looks like it's going to be fixed for v12.0 for sure. I'm still nudging to see if a v11.x fix is possible. Node v11 active support ends in April and is EOL by July (odd number releases are shorter since they aren't LTS).
Update:
Patch landed for Node v12.