我无法在Visual Studio Code上启动调试器,也无法在chrome上启动CORS扩展,它只是在我控制纱线启动时不会出现。
在调试时是否可以指定我想在Chrome上启用CORS扩展?
这是我的launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceRoot}/src"
}
]
}
您可以通过使用参数--disable-web-security
启动它来指示Chrome实例允许CORS。要从VS Code执行此操作,请使用runtimeArgs
配置选项,即
{
"version": "0.2.0",
"configurations": [
{
"name": "Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceRoot}/src",
"runtimeArgs": ["--disable-web-security"]
}
]
}