You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{
// Use IntelliSense to learn about possible attributes.// Hover to view descriptions of existing attributes.// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "调试 vite 项目",
"runtimeArgs": ["--auto-open-devtools-for-tabs"],
"userDataDir": "C:/Users/Administrator/AppData/Local/Google/Chrome/User Data",
"url": "http://localhost:3000"
}
]
}
参考链接
如何让 Vue、React 代码的调试变得更爽
The text was updated successfully, but these errors were encountered:
基本步骤
用 VS Code 调试 Nuxt
Vue 项目的路径 source-map 需要单独映射一下,才能对应到源码的位置,因为默认的源码映射会在文件后添加
hash
值(类似 [resource-path]?[hash])。也就是调试配置里多了个 sourceMapPathOverrides:
.vscode/launch.json
了解 outputdevtoolmodulefilenametemplate 配置,通过修改配置 自定义每个 source map 的 sources 数组中使用的名称,修改默认的文件名映射。
nuxt.config.js
用 VS Code 调试 Vite 项目
使用 npm scripts 命令启动 vite 后,需要修改 vite.config.js 配置,开启 source-map,同时修改 sourcemapPathTransform,将相对路径替换为绝对路径。
配置 vscode 调试配置,点击播放按钮开始调试
参考链接
The text was updated successfully, but these errors were encountered: