Install the JavaScript Debugger (Nightly) extension in VS Code if your VS Code version does not already provide the required browser-debugging support.
Add the following debugging configuration to
.vscode/launch.json:
1 | { |
Update url if the Cocos Creator preview server uses another port, and replace runtimeExecutable with the actual path to Chrome on your computer.
--disable-web-security weakens browser security for that debug profile. Use it only when local cross-origin testing genuinely requires it, keep the dedicated userDataDir, and do not use that browser instance for ordinary browsing or authenticated services.