Open cathrinevaage opened 5 years ago
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.
--inspect
OS: macOS Mojave 10.14.4 Node version: 11.14.0 Esm version: 3.2.25
a.js
import './b.js'
console.log({ test: true })
2. Create a js file, `b.js`
// Empty file
3. 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
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?
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:
a.js
console.log({ test: true })
// Empty file
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 }
{ test: true }
{ test: true }