visual-studio-code - How setup VSCode + Chrome Debugger + Docker in MacOS (Docker for Mac)
问题描述
I use Docker for Mac (Version 18.06.1-ce-mac74 (26766)) and I needed to configure the Google Chrome Debugger in VSCode. The configurations found on the internet did (How https://medium.com/@drcallaway/debugging-es6-in-visual-studio-code-4444db797954) not work for me. I share how I configured everything to work:
解决方案
Structure Project
/.vscode
/launch.json
/admin
/node_modules
/public
/src
/package.json
/docker-compose.yaml
/.vscode/launch.json
{
"version": "0.2.0",
"configurations":{
"name": "Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceRoot}/admin/src",
"sourceMapPathOverrides": {
"/srv/my-admin/src/*": "${webRoot}/*"
},
"runtimeArgs": [
"--remote-debugging-port=9222"
]
}
}
docker-compose.yaml
version: '3.5'
services:
node:
image: node:8.11.4-alpine
working_dir: /srv
volumes:
- $PWD/admin:/srv/my-admin
ports:
- 3000:3000
- 9222:9222
command: yarn --cwd my-admin start
Try and fun!!!
推荐阅读
- ajax - 来自 Ajax 的 MVC Web Api 调用以 404 响应
- php - 在 PHP 中在 Sprintf 之外使用 %S
- python - 如何根据扩展名打开文件?
- javascript - 在三元运算中返回多个值
- firebase - firebase 重置密码控制器
- c++ - 源文件编码或执行字符集是否会改变 wchar_t 内部保存的方式?
- mysql - 仅当 p.user 是页面创建者时,如何首先显示 block = 1 的成员?
- url - FlowRouter 将 url(路由)前缀附加到所有链接
- javascript - Vue.js2 - Object.assign({}, this.var) 防止监视方法
- spring - Spring Boot Web 测试 - 404 未找到