Approach
Simply ensure that vue3 generates sourcemap code. Use the project template, such as the one provided by the official vue, or the original index.html, to reference the relevant packages or libraries. The former likely involves package sharing, where the vue3 source code is built and then linked globally. In your project, remove the official vue remote package link and use the local package instead.
Run Directly
# 不用更改任何配置
pnpm i
pnpm dev
# 可以看到 packages/vue/dist/ 出现的产物, 及 map 文件
{
"version": "0.2.0",
"configurations": [
// 调试 npm run build 或者类似脚本
{
"name": "vue build",
"request": "launch",
"runtimeArgs": [
"run",
"build"
],
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"cwd": "${workspaceFolder}/vue"
},
// 远程 url 调试, 这里面要注意 outFiles, 此处未加, 实际需要加
{
"type": "msedge",
"request": "launch",
"name": "vue-project",
"url": "http://localhost:5173/",
"webRoot": "${workspaceFolder}/vue-project"
},
// 原始 index.html 调试, 同上个原理一致
{
"type": "msedge",
"request": "launch",
"name": "raw-html",
"url": "${workspaceFolder}/temp/index.html",
"webRoot": "${workspaceFolder}/temp",
"outFiles": [
"${workspaceFolder}/packages/**/*.js",
]
}
]
}
Complete Process
- Vue project
- Create native HTML
- Create a Vue template project
git clone [email protected]:vuejs/core.git
cd core
pnpm i
pnpm dev
mkdir -p temp && touch temp/index.html
# vue-project
pnpm create vue@latest
TODO: Debug video
Comments (0)
No comments yet. Be the first to leave one!