handlebars-lang / handlebars.js

Minimal templating on steroids.
http://handlebarsjs.com
MIT License
17.96k stars 2.04k forks source link

Requiring handlebars breaks debugging session #1926

Closed gzurbach closed 1 year ago

gzurbach commented 1 year ago

Not sure is this issue fits here. Apologies if that's not the case.

I am having issues debugging a large Node application. WebStorm does not "stop" on breakpoints despite the code working fine. After running my code step by step I was able to identify that the debugger stops working when loading Handlebars:

const Handlebars = require("handlebars");

Commenting out this line makes the debugger work again across the app.

In order to confirm this, I created a very basic project:

mkdir handlebars-test
cd handlebars-test
npm install handlebars
touch index.js
vim index.js

index.js:

const Handlebars = require("handlebars");
const template = Handlebars.compile("Name: {{name}}");
console.log(template({ name: "Nils" }));

When running a WebStorm debugger session, I am able to hit the first breakpoint:

Screenshot 2023-03-12 at 17 03 05

But the debugger never reaches the second breakpoint. It seems like something in there is "breaking" the debugger 🤔

I am not sure how to investigate this. I was wondering if others ran into this issue as well?

Edit: tried with both node 16 and node 18.

gzurbach commented 1 year ago

My bad this was due to a bug in WebStorm version 2022.3.3 😓

Rolling back to 2022.3.1 fixed the issue.