esm
esm copied to clipboard
Esm with --inspect causes empty objects to be logged
When you use the --inspect
flag, and log an object (not a primitive) in a module where you import another module, an empty object is prepended to the logged string.
Versions
OS: macOS Mojave 10.14.4 Node version: 11.14.0 Esm version: 3.2.25
Steps to reproduce:
- Create a js file,
a.js
import './b.js'
console.log({ test: true })
- Create a js file,
b.js
// Empty file
- Run
a.js
with-r esm
and--inspect
node --inspect -r esm a.js
Debugger listening on ws://127.0.0.1:9229/0708c791-0b7e-4b0c-a8ed-ef8137b9d05d
For help, see: https://nodejs.org/en/docs/inspector
{} { test: true }
If you run a.js
without --inspect
, the output will be
{ test: true }
If you remove the import statement at the beginning of a.js
, the output will also be
{ test: true }
Logging a primitive will not produce the prepended empty object. The content of the imported module doesn't seem to change anything.
Thanks @cathrinevaage!
I've experienced this before so this seems to be a bit of cat and mouse for us.
what does it mean "seems to be a bit of cat and mouse for us". Does it not repo above?