Moonglade

Modern Markdown blogging with AI-powered localization and search.

Tag: sourcemap

RSS

debug vue3 source code

This article introduces a simple solution for implementing source code debugging in Vue 3 projects. The core idea is to leverage the sourcemap files generated during the Vue 3 build process, combined with VS Code debugging configuration, allowing direct execution without modifying complex configurations. The article first demonstrates how to install dependencies using `pnpm` and run the development command, resulting in build artifacts in the `dist` directory that include map files. It then provides detailed `launch.json` configuration examples covering three debugging scenarios: first, Node.js debugging for the `npm run build` script; second, debugging remotely loaded Vue projects via URL, where it is important to set `webRoot`; and third, debugging original HTML files that reference local Vue packages, requiring correct configuration of `outFiles` to map source code paths. The article also lists complete environment setup steps, including cloning the Vue core repository, creating temporary HTML test files, and creating a Vue project using the official template. This solution aims to help developers quickly establish a debugging chain from browser breakpoints to Vue source code, improving development efficiency. Plans are in place to supplement this with a debugging video demonstration in the future.

Views 60
daily sourcemap study vue vue3 web