我知道这是一个到处都有很多答案的问题,但是我无法调试SSR React App ...我已经尝试了Launch Program并生成了它,但断点从未触及(也许是带有源映射的东西(我不知道),并且没有CSS,所有请求都被拒绝。理想的选择可能是“使用Npm脚本运行”,因此我可以使用自己的构建系统,我尝试使用--inspect-brk选项启动我的启动脚本,但未成功。预先感谢。
那是我的vscode启动配置:
{
"type": "node",
"request": "launch",
"name": "Launch via NPM",
"runtimeExecutable": "npm.cmd",
"runtimeArgs": ["run-script", "debug"],
"port": 9229,
"sourceMaps": true
},
我的脚本:
"scripts": {
"debug": "cross-env NODE_ENV=development node --inspect-brk scripts/start.js",
"analyze": "yarn-or-npm build:with-stats && yarn-or-npm start:analyzer",
"build": "cross-env NODE_ENV=production node scripts/build.js",
"build:with-stats": "cross-env NODE_ENV=production webpack --config config/webpack.config.js/client.prod.js --json > build/client/static/bundle-stats.json",
"link-react": "yarn-or-npm link react react-dom",
"lint": "concurrently \"yarn-or-npm lint:js\" \"yarn-or-npm lint:css\"",
"lint:js": "eslint ./src",
"start": "cross-env NODE_ENV=development node scripts/start.js",
"start:analyzer": "webpack-bundle-analyzer build/client/static/bundle-stats.json",
"lint:css": "stylelint ./src/**/*.css",
"test": "node scripts/test.js --env=jsdom",
"test:update": "yarn-or-npm test --updateSnapshot"
},