-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Description
- Version: v8.8.1
- macOS Sierra: Darwin MacBook-Air.local 17.0.0 Darwin Kernel Version 17.0.0: Thu Aug 24 22:01:05 PDT 2017; root:xnu-4570.1.46~3/RELEASE_X86_64 x86_64
- Subsystem: ES6 Module loader
I branched my code and converted everything to ES6 import and export statements.
I then ran from the command line the following, and it worked just fine:
node --experimental-modules bin/api-server.mjs
Then I tried to debug with VSCode, and the debugger crashed. I then tried to attach directly from Chrome using chrome://inspect, same issue occurred.
I opened the following issue, which contains the dumps generated from vscode-node-debug which may be worth your attention.
microsoft/vscode-node-debug#165
This error seems to be triggered whenever I try to attach a debugger to the application, using the --inspect-brk flag.
Interestingly, If I use the --inspect flag and attach the debugger shortly after giving my application a moment to figure itself out, everything is fine.
Also importantly, it appears that if I cut big chunks out of my application reducing initialisation time with lots of modules taking ~2 seconds to fire up down to an almost instant startup time... then running with --inspect-brk worked ok as well.
I can only conclude that premature attachment of the debugger is interfering with the ES6 module initialisation stage if that stage is sufficiently long enough... this is a critical issue for developing an codebases with a half decent size.