Modern Web Debugging

Spanish audio is available in the player settings
Rate this content
Bookmark

Few developers enjoy debugging, and debugging can be complex for modern web apps because of the multiple frameworks, languages, and libraries used. But, developer tools have come a long way in making the process easier. In this talk, Jecelyn will dig into the modern state of debugging, improvements in DevTools, and how you can use them to reliably debug your apps.

This talk has been presented at JSNation 2023, check out the latest edition of this JavaScript Conference.

FAQ

In Chrome DevTools, you can set conditional breakpoints and logpoints by using command-click on any line in your code. This allows you to set conditions for when a breakpoint should be hit or add logpoints without modifying your code.

Some new features in Chrome DevTools for debugging include hiding irrelevant frames in the console and call stack, grouping files by authored and deployed in the sources panel, and using source maps to map compressed files back to their original sources.

In Chrome DevTools, irrelevant frames can be hidden by default during debugging. You can also manually choose to show or hide these frames by clicking on the 'Show More Frames' button in the console or call stack.

A source map is a file that maps compressed versions of your files back to the original source code. Chrome DevTools uses source maps to display your original code during debugging, allowing for a cleaner and more understandable debugging experience.

Some productivity tips for Chrome DevTools include using the toggle CSS class feature, overriding HTTP response headers, using JavaScript snippets for common tasks, and using the command panel to quickly access DevTools features.

Chrome DevTools uses source map extensions to ignore irrelevant files during debugging. Frameworks and build tools can populate specific fields in the source map to indicate which files should be ignored. You can also manually add files or directories to the ignore list in DevTools.

You can report bugs or issues with Chrome DevTools by visiting the DevTools team's reporting URL or tweeting at @ChromeDevTools. Reporting helps the team identify and fix issues to improve the tool.

To debug minified production code, generate a source map and save it in a secure location. In Chrome DevTools, right-click on any JavaScript file, click on 'Attach Source Map,' and attach your source map to debug the production code.

You can override HTTP response headers in Chrome DevTools by going to the network panel, selecting a request, and editing the headers. This allows you to add or modify headers such as Access-Control-Allow-Origin to continue development without waiting for backend changes.

JavaScript snippets in Chrome DevTools are reusable pieces of code that you can save and run at any time. They are useful for performing common tasks repeatedly. You can save a snippet in the Sources panel and run it using Command+P followed by an exclamation mark and the snippet name.

Jecelyn Yeen
Jecelyn Yeen
29 min
01 Jun, 2023

Comments

Sign in or register to post your comment.
Video Summary and Transcription
This Talk discusses modern web debugging and the latest updates in Chrome DevTools. It highlights new features that help pinpoint issues quicker, improved file visibility and source mapping, and ignoring and configuring files. The Breakpoints panel in DevTools has been redesigned for easier access and management. The Talk also covers the challenges of debugging with source maps and the efforts to standardize the source map format. Lastly, it provides tips for improving productivity with DevTools and emphasizes the importance of reporting bugs and using source maps for debugging production code.
Available in Español: Depuración Web Moderna

1. Introduction to Web Debugging and DevTools

Short description:

Hello everyone. Today I'm going to talk about modern web debugging and DevTools. I work in the Chrome DevTools team and share exciting updates about Chrome DevTools. 15 years ago, web development was different. Now we use different languages and frameworks. I'll share tools to improve debugging.

Hello everyone. Yes. So today I'm going to talk about modern web debugging and DevTools. So my name is Jesslyn. This is my handler because I like fish so much. That's why my handler is Jackfish as well.

So I work in the Chrome DevTools team. If every release you did not just dismiss this what's new tab, if you click on it, you might have seen my face before because every new release I will share some exciting news, exciting updates about Chrome DevTools and show you some tips about how to make you be productivity with Chrome DevTools.

So let's start my talk with this screenshot from 15 years ago. So this is the DevTools 15 years ago. You'll notice that there's much less tab, much less panel that you can use. And more interestingly, there's something called crypto as well. So crypto started since that time, but not really. The time, that time when we developed web applications, is so much more different than how we develop web applications now.

For example, back in the time you, when you started we just use HTML, CSS and pure JavaScript to do development. Then after that, we want to improve the performance. Then we start to compress and minify our CSS and JavaScript. Go to the days, now, nowadays what you write is not exactly what the browser reads. For example, you use different languages to write your applications. You use JSX, you use Spark, for example. You use CSS or less for CSS. You use TypeScript to replace JavaScript. And you use a lot of different frameworks as well, like Angular, React and Vue. And we have even meta frameworks like Next and Nuxt as well. And all these tools need to go through a process to compile it and compress it and transform it to what the browsers can understand. And we also need Vue 2 like Vite, Webpack, rollout and ESVue, like a lot of these tools to make everything work.

Now, since the day that we start Web development until now that we are no longer using just HTML, CSS and JavaScript to develop your applications, how about debugging? Do we have any advancement on debugging as well? So, today, I'm going to share with you a few tools to improve your debugging because it is important. This is us. We code for six minutes probably, copy paste, do some research, check GPT or Stack Overflow, paste the code in, but it just doesn't work and we spent six hours to debug it. Okay.

2. New Features for Quicker Issue Identification

Short description:

Let's start with how some of the new features that help you to pinpoint issues quicker. So, one of the things you'll do during debugging is check the console for error logs. Previously, irrelevant frameworks cluttered the console, making it harder to identify issues. Now, we hide the additional frames and show only what's relevant to your application. You can also view the call stack and hide irrelevant frames. Another feature is the ability to view your code first, making it closer to your IDE.

Let's start with how some of the new features that help you to pinpoint issues quicker. So, one of the thing that when you face and you have any issues during the debugging, the first thing probably you will go to is the console to see there is any error log in the console.

So, imagine you go to this page and then you see this console. It doesn't quite helpful when you do development. So, the first screenshot here is a screenshot from the Angular app, and the next one is from Vue.js. So, let me open a sample applications here. Okay.

So, for example, if I click on this increase button. If I open it, this is what we see now. So, previously, if you compare this screenshot, this application on the previous one, you notice that previously, you see a lot of irrelevant frameworks called like Zone.js, Async to Generator.js, like all these irrelevant JavaScript file which is belong to the framework itself. But now, if you open this, what we do is that we hide all the additional frames. All the irrelevant frames just show you what exactly happens in your application, your components. So, for example, you see, like, we show you, like, the problem could be in the app component and the button component. And if you want to see like the framework's code itself, you can click on Show More Frames and to open and check for all the others as well. But you don't have to do it. This is what you see previously. There's a long list until you can identify where is the issues.

Another thing that you can do is that during the debugging, we also improve the... So this is a Vue.js application. During the debugging, you have the same... We have the same features as well. So, for example, I put a breakpoint here. If I click on Add, increase the number. You can see that in the call stack, on the right here, we also hide all the irrelevant frames. We only show you what is relevant. Like, we show you the increment functions, and we show that you're currently in await functions in the increment. And if you want to see all the ignored frames, you can click on this and expand, and you see all the others that are not so relevant to what you are debugging right now. And another new feature that you can try it out is to view your code first. Like, some of the feedback that we get is that, from the view here, like your sources panel here, what you see is what the browser actually reads mixed with what your actual code, when you open it in IDE. So, if you want to see the view that's closer to your IDE, what you can do is click on this file button in the sources panel, select group by authored and deployed.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

The Future of Performance Tooling
JSNation 2022JSNation 2022
21 min
The Future of Performance Tooling
Top Content
Today's Talk discusses the future of performance tooling, focusing on user-centric, actionable, and contextual approaches. The introduction highlights Adi Osmani's expertise in performance tools and his passion for DevTools features. The Talk explores the integration of user flows into DevTools and Lighthouse, enabling performance measurement and optimization. It also showcases the import/export feature for user flows and the collaboration potential with Lighthouse. The Talk further delves into the use of flows with other tools like web page test and Cypress, offering cross-browser testing capabilities. The actionable aspect emphasizes the importance of metrics like Interaction to Next Paint and Total Blocking Time, as well as the improvements in Lighthouse and performance debugging tools. Lastly, the Talk emphasizes the iterative nature of performance improvement and the user-centric, actionable, and contextual future of performance tooling.
Debugging JS
React Summit 2023React Summit 2023
24 min
Debugging JS
Top Content
Watch video: Debugging JS
Debugging JavaScript is a crucial skill that is often overlooked in the industry. It is important to understand the problem, reproduce the issue, and identify the root cause. Having a variety of debugging tools and techniques, such as console methods and graphical debuggers, is beneficial. Replay is a time-traveling debugger for JavaScript that allows users to record and inspect bugs. It works with Redux, plain React, and even minified code with the help of source maps.
pnpm – a Fast, Disk Space Efficient Package Manager for JavaScript
DevOps.js Conf 2022DevOps.js Conf 2022
31 min
pnpm – a Fast, Disk Space Efficient Package Manager for JavaScript
Watch video: pnpm – a Fast, Disk Space Efficient Package Manager for JavaScript
pnpm is a fast and efficient package manager that gained popularity in 2021 and is used by big tech companies like Microsoft and TikTok. It has a unique isolated node module structure that prevents package conflicts and ensures each project only has access to its own dependencies. pnpm also offers superior monorepo support with its node module structure. It solves the disk space usage issue by using a content addressable storage, reducing disk space consumption. pnpm is incredibly fast due to its installation process and deterministic node module structure. It also allows file linking using hardlinks instead of symlinks.
From Friction to Flow: Debugging With Chrome DevTools
JSNation 2024JSNation 2024
32 min
From Friction to Flow: Debugging With Chrome DevTools
The Talk discusses the importance of removing frictions in the debugging process and being aware of the tools available in Chrome DevTools. It highlights the use of the 'Emulate a Focus Page' feature for debugging disappearing elements and the improvement of debugging tools and workflow. The Talk also mentions enhancing error understanding, improving debugging efficiency and performance, and the continuous improvement of DevTools. It emphasizes the importance of staying updated with new features and providing feedback to request new features.
Beyond Virtual Lists: How to Render 100K Items with 100s of Updates/sec in React
React Advanced 2021React Advanced 2021
27 min
Beyond Virtual Lists: How to Render 100K Items with 100s of Updates/sec in React
Top Content
The Talk discusses optimizing rendering of big tables using Flipper, a new version that is ten times faster with improved user interaction and richer data. It explores optimizing rendering with React, virtualization, filtering, sorting, and windowing techniques. The introduction of the Flipper Datasource packet simplifies handling updates, inserts, and removals. The performance of the Flipper data source package is excellent, even in a debug build of React, with minimal CPU usage. The Q&A session covers incremental sorting, dynamic row height, and the potential for two-dimensional virtualization in the future.
Debugging with Chrome DevTools
JSNation Live 2021JSNation Live 2021
11 min
Debugging with Chrome DevTools
Here are some tips for better utilizing DevTools, including using the run command, customizing keyboard shortcuts, and emulating the focus effect. Learn how to inspect memory, use the network panel for more control over network requests, and take advantage of console utilities. Save frequently used code as snippets and use local overrides for easy editing. Optimize images by using a more optimized format like AVIF and track changes in the network panel to see the reduced data size.

Workshops on related topic

React Performance Debugging Masterclass
React Summit 2023React Summit 2023
170 min
React Performance Debugging Masterclass
Top Content
Featured WorkshopFree
Ivan Akulov
Ivan Akulov
Ivan’s first attempts at performance debugging were chaotic. He would see a slow interaction, try a random optimization, see that it didn't help, and keep trying other optimizations until he found the right one (or gave up).
Back then, Ivan didn’t know how to use performance devtools well. He would do a recording in Chrome DevTools or React Profiler, poke around it, try clicking random things, and then close it in frustration a few minutes later. Now, Ivan knows exactly where and what to look for. And in this workshop, Ivan will teach you that too.
Here’s how this is going to work. We’ll take a slow app → debug it (using tools like Chrome DevTools, React Profiler, and why-did-you-render) → pinpoint the bottleneck → and then repeat, several times more. We won’t talk about the solutions (in 90% of the cases, it’s just the ol’ regular useMemo() or memo()). But we’ll talk about everything that comes before – and learn how to analyze any React performance problem, step by step.
(Note: This workshop is best suited for engineers who are already familiar with how useMemo() and memo() work – but want to get better at using the performance tools around React. Also, we’ll be covering interaction performance, not load speed, so you won’t hear a word about Lighthouse 🤐)
React, TypeScript, and TDD
React Advanced 2021React Advanced 2021
174 min
React, TypeScript, and TDD
Top Content
Featured WorkshopFree
Paul Everitt
Paul Everitt
ReactJS is wildly popular and thus wildly supported. TypeScript is increasingly popular, and thus increasingly supported.

The two together? Not as much. Given that they both change quickly, it's hard to find accurate learning materials.

React+TypeScript, with JetBrains IDEs? That three-part combination is the topic of this series. We'll show a little about a lot. Meaning, the key steps to getting productive, in the IDE, for React projects using TypeScript. Along the way we'll show test-driven development and emphasize tips-and-tricks in the IDE.
Mastering advanced concepts in TypeScript
React Summit US 2023React Summit US 2023
132 min
Mastering advanced concepts in TypeScript
Top Content
Featured WorkshopFree
Jiri Lojda
Jiri Lojda
TypeScript is not just types and interfaces. Join this workshop to master more advanced features of TypeScript that will make your code bullet-proof. We will cover conditional types and infer notation, template strings and how to map over union types and object/array properties. Each topic will be demonstrated on a sample application that was written with basic types or no types at all and we will together improve the code so you get more familiar with each feature and can bring this new knowledge directly into your projects.
You will learn:- - What are conditional types and infer notation- What are template strings- How to map over union types and object/array properties.
Integrating LangChain with JavaScript for Web Developers
React Summit 2024React Summit 2024
92 min
Integrating LangChain with JavaScript for Web Developers
Featured Workshop
Vivek Nayyar
Vivek Nayyar
Dive into the world of AI with our interactive workshop designed specifically for web developers. "Hands-On AI: Integrating LangChain with JavaScript for Web Developers" offers a unique opportunity to bridge the gap between AI and web development. Despite the prominence of Python in AI development, the vast potential of JavaScript remains largely untapped. This workshop aims to change that.Throughout this hands-on session, participants will learn how to leverage LangChain—a tool designed to make large language models more accessible and useful—to build dynamic AI agents directly within JavaScript environments. This approach opens up new possibilities for enhancing web applications with intelligent features, from automated customer support to content generation and beyond.We'll start with the basics of LangChain and AI models, ensuring a solid foundation even for those new to AI. From there, we'll dive into practical exercises that demonstrate how to integrate these technologies into real-world JavaScript projects. Participants will work through examples, facing and overcoming the challenges of making AI work seamlessly on the web.This workshop is more than just a learning experience; it's a chance to be at the forefront of an emerging field. By the end, attendees will not only have gained valuable skills but also created AI-enhanced features they can take back to their projects or workplaces.Whether you're a seasoned web developer curious about AI or looking to expand your skillset into new and exciting areas, "Hands-On AI: Integrating LangChain with JavaScript for Web Developers" is your gateway to the future of web development. Join us to unlock the potential of AI in your web projects, making them smarter, more interactive, and more engaging for users.
From Todo App to B2B SaaS with Next.js and Clerk
React Summit US 2023React Summit US 2023
153 min
From Todo App to B2B SaaS with Next.js and Clerk
WorkshopFree
Dev Agrawal
Dev Agrawal
If you’re like me, you probably have a million side-project ideas, some that could even make you money as a micro SaaS, or could turn out to be the next billion dollar startup. But how do you know which ones? How do you go from an idea into a functioning product that can be put into the hands of paying customers without quitting your job and sinking all of your time and investment into it? How can your solo side-projects compete with applications built by enormous teams and large enterprise companies?
Building rich SaaS products comes with technical challenges like infrastructure, scaling, availability, security, and complicated subsystems like auth and payments. This is why it’s often the already established tech giants who can reasonably build and operate products like that. However, a new generation of devtools are enabling us developers to easily build complete solutions that take advantage of the best cloud infrastructure available, and offer an experience that allows you to rapidly iterate on your ideas for a low cost of $0. They take all the technical challenges of building and operating software products away from you so that you only have to spend your time building the features that your users want, giving you a reasonable chance to compete against the market by staying incredibly agile and responsive to the needs of users.
In this 3 hour workshop you will start with a simple task management application built with React and Next.js and turn it into a scalable and fully functioning SaaS product by integrating a scalable database (PlanetScale), multi-tenant authentication (Clerk), and subscription based payments (Stripe). You will also learn how the principles of agile software development and domain driven design can help you build products quickly and cost-efficiently, and compete with existing solutions.
React Performance Debugging
React Advanced 2023React Advanced 2023
148 min
React Performance Debugging
Workshop
Ivan Akulov
Ivan Akulov
Ivan’s first attempts at performance debugging were chaotic. He would see a slow interaction, try a random optimization, see that it didn't help, and keep trying other optimizations until he found the right one (or gave up).
Back then, Ivan didn’t know how to use performance devtools well. He would do a recording in Chrome DevTools or React Profiler, poke around it, try clicking random things, and then close it in frustration a few minutes later. Now, Ivan knows exactly where and what to look for. And in this workshop, Ivan will teach you that too.
Here’s how this is going to work. We’ll take a slow app → debug it (using tools like Chrome DevTools, React Profiler, and why-did-you-render) → pinpoint the bottleneck → and then repeat, several times more. We won’t talk about the solutions (in 90% of the cases, it’s just the ol’ regular useMemo() or memo()). But we’ll talk about everything that comes before – and learn how to analyze any React performance problem, step by step.
(Note: This workshop is best suited for engineers who are already familiar with how useMemo() and memo() work – but want to get better at using the performance tools around React. Also, we’ll be covering interaction performance, not load speed, so you won’t hear a word about Lighthouse 🤐)