Code behaves differently in Firefox if Developer Tools is open

I just recently fixed an issue in my web application with the help of dev tools (then made the changes in the source files). After the fix, the bug was gone.

But if i opened it fresh (without a developer tools open) the bug was there again, but as soon as I opened dev tools (doing nothing else with it), the bug disappeared again. (It doesn’t matter if the dev tools is in the same window or in a separate one.) It’s like the fix is only working if I have the dev tools open.

Is there any way that the presence of developer tools can modify how the code works in Firefox? I haven’t found any topic that is similar to this, and it is veeery weird.

I use Firefox 60.0.1 but tested on 56.0 as well with the same results. The language is JavaScript and I use polyfill as well.