VSCode react-native打字稿:断点被忽略,因为找不到源代码 [英] VSCode react-native typescript: breakpoints ignored because source code not found

查看:115
本文介绍了VSCode react-native打字稿:断点被忽略,因为找不到源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在我的本机项目中的打字稿文件中命中断点。我在stackoverflow和github上都看过各种类似的问题。 (此处,此处
这是我的tsconfig.json:

I am unable to have my breakpoints hit in my typescript files inside my react-native project. I have looked at various similar questions here at stackoverflow and also on github. (here, here) Here is my tsconfig.json:

{
    "compilerOptions": {
        "target": "es2015",
        "module": "es2015",
        "jsx": "react",
        "outDir": "build",
        "rootDir": "src",
        "allowSyntheticDefaultImports": true,
        "noImplicitAny": true,
        "experimentalDecorators": true,
        "preserveConstEnums": true,
        "allowJs": true,
        "sourceMap": true
    },
    "filesGlob": [
        "typings/index.d.ts",
        "src/**/*.ts",
        "src/**/*.tsx"
    ],
    "exclude": [
        "index.android.js",
        "index.ios.js",
        "build",
        "node_modules"
    ],
    "compileOnSave": false
}

首先,我使用Visual Studio代码构建任务(ctrl + shift + B)构建我的源代码;每件事物都可以构建良好,并且<$ c $ .js 文件以及相应的 .js.map 文件都会在<$ c $内部生成c> ./ build 文件夹。

First I build my sources using visual studio code build task (ctrl+shift+B); every thing builds fine and .js files along with corresponding .js.map files are generated inside the ./build folders.

然后我在launch.json中创建启动配置

Then I create a launch configuration in the launch.json

从Visual Studio代码中,我开始调试过程(f5)。一切正常,应用程序已加载并显示在我的genymotion模拟器中。

From within visual studio code I start the debug process (f5). Every thing works fine and app is loaded and displayed inside my genymotion emulator.

但是打字稿中的断点永远不会出现。 (尽管它们在生成的 .js 文件中被击中)

But breakpoints inside typescript are never hit. (They are hit inside the generated .js files though)

我在这里完全迷失了。不管我做什么,我都无法获得断点来击中击球……

I am completely at lost here. No matter what I do I can't get the breakpoints to get hit...

任何帮助将不胜感激。

推荐答案

我已经应用了 github帖子特别是要评论此PR 现在我的断点起作用了。

I have applied the suggestion from this github post especially to comment about this PR and now my breakpoints work.

这篇关于VSCode react-native打字稿:断点被忽略,因为找不到源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆