javascript - Debug cache-busted scripts in production - Stack Overflow
I am working on a front-end project (JavaScript files) and the server adds a cache-busting value to the end of the URL, e.g., .js&bust=0.5647534393
My problem is I lose any breakpoints set in Chrome's Developer Tools after reloading. I do not have access to the server to disable it.
Is there any way to work around this constraint?
UPDATE: Adding debugger;
to the JS source code is not a viable solution because I'm debugging production code.
I am working on a front-end project (JavaScript files) and the server adds a cache-busting value to the end of the URL, e.g., http://www.example./myfile.js&bust=0.5647534393
My problem is I lose any breakpoints set in Chrome's Developer Tools after reloading. I do not have access to the server to disable it.
Is there any way to work around this constraint?
UPDATE: Adding debugger;
to the JS source code is not a viable solution because I'm debugging production code.
- 3 i can't recall ever seeing anything like this, seems like a good point to bring up... – dandavis Commented Mar 4, 2016 at 20:38
- have you tried location.reload(true) in the console? may work (not sure, though) – Dominik Commented Mar 7, 2016 at 14:58
- @Dominik that seems like the opposite of what OP wants. – Evan Davis Commented Mar 7, 2016 at 14:59
- Any part of this discussion help you? stackoverflow./questions/8243742/… – James Hill Commented Mar 7, 2016 at 15:00
- 2 Why don't you "bust" it if it changes; aka, use a file timestamp or hash or mit number, as a parameter? :) – Caramiriel Commented Mar 7, 2016 at 16:07
2 Answers
Reset to default 6 +50You can use a URL-rewrite Chrome plugin like Requestly (not free) or Redirector (free) and add redirect rule for your scripts.
Requestly for example lets you specify rules like:
I'm OFC assuming that if you strip the ?bust=xxxx
part from the URL the server will still serve the correct script file. I tested it and it works like a charm in my local test environment - the breakpoints remain.
Hope it helps.
You can use debugger;
within your code. If the developer console is open, execution will break. It works in firebug as well.
- Windows 10盗版不易?所以在中国普及速度极慢
- 奇虎起诉腾讯:“中国互联网反垄断第一案”今日开庭
- How can I design a button with two colors and a curved border in CSS? - Stack Overflow
- amazon web services - Download large file from AWS S3 with Go SDK v2 - Stack Overflow
- I need help importing my global.css file in next.js - Stack Overflow
- dart - Flutter local notification throws error when i try to setup scheduled Notification - Stack Overflow
- flutter - Error handshake exception: handshake error in client(os error: certificate _verify_failed: unable to get local issuer
- php - No client_secret for Stripe Elements with Subscription billing_cycle_anchor - Stack Overflow
- python - invoke matplotlib toolbar keeping custom views history - Stack Overflow
- java - Bluej throws SSLHandshakeException making http request - Stack Overflow
- malloc - C memory leak warning - Stack Overflow
- laravel - Customizing Fortify for Multi-Tenant Password Resets Tokens with Domain-Specific Tokens - Stack Overflow
- perl - How to get a diagnostic from Moo when I try to set an unknown attribute in the constructor? - Stack Overflow
- How to debug Quarkus producer method - Stack Overflow
- javascript - How can I create hyperlinkOrPicture column types on SharePoint Lists with Microsoft Graph API or Sharepoint API? -
- python - Reading .msg attachments from a .msg file - Stack Overflow
- r - How to change the collapse breakpoints of a bslib navbar? - Stack Overflow