Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

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

Closed
Mensu opened this issue Jan 3, 2018 · 4 comments
Closed
Labels

Comments

@Mensu
Copy link

Mensu commented Jan 3, 2018

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!

@jdalton
Copy link
Member

jdalton commented Jan 3, 2018

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 jdalton closed this as completed Jan 3, 2018
@jdalton jdalton added the invalid label Jan 3, 2018
@Mensu
Copy link
Author

Mensu commented Jan 4, 2018

@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!

@jdalton jdalton added bug and removed invalid labels Jan 4, 2018
@jdalton jdalton reopened this Jan 4, 2018
@jdalton
Copy link
Member

jdalton commented Jan 4, 2018

Thanks @Mensu!

I can repro this.

Update:

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

@jdalton
Copy link
Member

jdalton commented Jan 6, 2018

@std/esm v0.19.0 is released 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants