ReactNative + TypeScript + WebStorm - 调试无法正常工作

时间:2018-04-27 18:32:29

标签: reactjs typescript react-native webstorm

使用WebStorm IDE时,我在调试用TypeScript编写的ReactNative应用程序时遇到问题。

应用程序有效,但是当我将断点设置为render时,方法代码从未停止过。

这是我的tsconfig:

  {
    "compilerOptions": {
      "module": "commonjs",
      "target": "es5",
      "sourceMap": true,
      "moduleResolution": "node",
      "jsx": "react-native",
      "outDir": "artifacts",
      "rootDir": "src",
      "noImplicitAny": false,
      "preserveConstEnums": true,
      "allowJs": false,
      "sourceMap": true,
      "noImplicitReturns": true,
      "noUnusedParameters": true,
      "noUnusedLocals": true
    },
    "filesGlob": [
      "typings/index.d.ts",
      "src/**/*.ts",
      "src/**/*.tsx"
    ],
    "types": [
      "react",
      "react-native",
      "jest"
    ],
    "exclude": [
      "android",
      "ios",
      "build",
      "node_modules"
    ]
  }

和package.json:

  {
    "name": "untitled2",
    "version": "0.0.1",
    "private": true,
    "scripts": {
      "tsc": "tsc",
      "start": "node node_modules/react-native/local-cli/cli.js start",
      "build": "npm run clean && npm run tsc --",
      "test": "jest"
    },
    "dependencies": {
      "react": "16.3.1",
      "react-native": "0.55.3",
      "inversify": "^4.13.0",
      "react-navigation": "^1.5.11"
    },
    "devDependencies": {
      "typescript": "^2.8.3",
      "tslint": "^5.9.1",
      "@types/react": "^16.3.12",
      "babel-jest": "22.4.3",
      "babel-preset-react-native": "4.0.0",
      "jest": "22.4.3",
      "react-test-renderer": "16.3.1"
    },
    "jest": {
      "preset": "react-native",
      "testRegex": "artifacts/.+\\.(test|spec).js$",
      "coverageDirectory": "coverage",
      "coverageReporters": [
        "text-summary",
        "html"
      ]
    },
    "collectCoverageFrom": [
      "artifacts/**/*.js",
      "!artifacts/**/*.spec.js",
      "!artifacts/**/*.index.js"
    ]
  }

1 个答案:

答案 0 :(得分:1)

注册表中的

js.debugger.break.on.first.statement.with.regexp(帮助|查找操作... |注册表)帮助我。

更多信息:https://youtrack.jetbrains.com/issue/WEB-32588