Esm: node gets stuck running files containing '# sourceMappingURL' with --inspect

Created on 3 Jan 2018  ·  4Comments  ·  Source: standard-things/esm

Hi, I just found that the node process would get stuck when running the following index.js file with node --inspect -r @std/esm index.js, which may somehow be related to #178 .

console.log('# sourceMappingURL')
console.log('work')

  • @std/esm version: 0.18.0
  • node version: 9.2 on macOS, 9.2 on Ubuntu 16.04 and 9.3 on Ubuntu 16.04

  • expected behavior: node exits after printing # sourceMappingURL and work

  • actual behavior: node gets stuck

I've tried some modifications, which may be helpful for debugging:

  • ✅ by removing --inspect flag: node -r @std/esm index.js works
  • ✅ by turning off source map option of @std/esm in package.json: "sourceMap": false works with --inspect flag
  • ✅ by removing the first line console.log('# sourceMappingURL')
  • ❌ by commenting the first line: // console.log('# sourceMappingURL') does not work
  • ❌ by adding console.log('first line') above the first line: node process gets stuck without even printing first line

Originally I found this when importing pug, which eventually requires [email protected]/lib/imports/inliner containing a regexp /\/\*# sourceMappingURL=(\S+) \*\//

Are there anything I am missing or doing wrong, or is this just a bug? Thanks in advance!

bug

Most helpful comment

Thanks @Mensu!

I can repro this.

Update:

I fixed the issue locally, will create a unit test and push in a bit.

All 4 comments

Hi @Mensu!

Can you please create a simple repro repo. I haven't been able to reproduce this in the past so without a repro repo this will end up getting closed as invalid.

Update:

I can't repro on master with the example provided.

@jdalton Sorry for my late reply. Here's the repro repo: Mensu/std-esm-repro-issue-207

I now found that it is NOT related to flag --inspect. It is related to the "sourceMap": true option. That's why I turned on this option in the repro repo by default.

I also tried requiring from master by the following steps, and node still got stuck...

git clone [email protected]:standard-things/esm.git
cd esm
npm i
npm run build:prod
cd ..
node -r ./esm index.js

I would be glad if you could check it out again with the repro repo. Thanks in advance!

Thanks @Mensu!

I can repro this.

Update:

I fixed the issue locally, will create a unit test and push in a bit.

@std/esm v0.19.0 is released :tada:

Was this page helpful?
0 / 5 - 0 ratings