Debugging

Debugging is an essential part of locating and fixing issues during development. Qingkuai component files are compiled into standard JavaScript modules, so you can use browser DevTools, the VS Code debugger, and tools like Vite to inspect component logic, reactive state, and rendering behavior. This article covers common debugging techniques for Qingkuai projects.


Source Maps

In development mode, the compiler generates source maps for component files by default, mapping compiled output back to the original component file across two dimensions:


Prerequisites


Script Debugging

For code inside embedded script blocks and template interpolations, you can open the corresponding component file in the browser DevTools Sources panel and set breakpoints there:
Script debugging

Reactive Values

In development mode, the compiler preserves the original identifiers of reactive values. In the DevTools Scope panel, you will notice that each reactive identifier has a corresponding wrapper value (usually prefixed with _), which is the actual reactive value used by the compiler internally. You can ignore it during debugging — the compiler-generated debug code automatically syncs the original identifier whenever the reactive value changes, so you can always focus solely on the original identifier:
Reactive value debugging

Directive Context

In development mode, the compiler attaches debug information to context identifiers created by directives, giving you a clearer picture of the directive's execution context:
Directive context debugging

Interpolation Block Updates

As you may have noticed from the screenshots above, the compiler creates mapping points at the start and end of each interpolation block. This allows you to clearly see the state of the DOM before and after an update, helping you better understand the component's update process.

If a tag's content contains multiple interpolation blocks, the start of the first block and the end of the last block correspond to the states before and after the DOM operation, respectively.

Style Debugging

For style blocks in component files, you can inspect element styles in the browser DevTools Elements panel. Click the file path next to a rule to navigate to the original style in the component file:
Style debugging

This will jump to the Sources panel and highlight the corresponding rule in the style block:
Style debugging


Edit this page on github (This page has been translated from the Chinese version of the site. There may be inaccuracies in the translation. We welcome your help to improve the accuracy of this document.)