标签: react-native-tools

无法在 vscode 上调试 expo 项目

我有一个 expo 项目,我们可以运行和构建它,它可以在 android 和 iOS 中正常工作。我想要的是使用我的 Visual Studio 代码调试所述项目。

我遵循了一些指南并尝试了以下操作:

  1. 在 vscode 中添加 React Native Tools 扩展。
  2. 在 vscode 调试器中添加“Attach to packager”配置。
  3. 更改 settings.json 中的“react-native.packager.port”以匹配 expo packager 端口(19001)
  4. 运行世博会(世博会开始)
  5. 并尝试在启用和禁用“远程调试 JS”以及打开或关闭 chrome 调试器的情况下启动调试器

我得到的结果是带有调试器控件的小窗口出现一秒钟然后消失,没有任何日志或证据表明它做了什么。我检查了 vscode 中的终端选项卡、输出选项卡和调试控制台选项卡

顺便说一句,当我启用“远程调试 JS”时,chrome 调试器会启动并完美运行。

我的 launch.json 是由 react native 工具扩展自动生成的。我还尝试将 "sourceMaps":true 添加到附加配置中,最终结果是一样的。这是我的代码:

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
    {
        "name": "Debug Android",
        "cwd": …
Run Code Online (Sandbox Code Playgroud)

debugging react-native visual-studio-code expo react-native-tools

6
推荐指数
2
解决办法
4974
查看次数

如何使用Expo和vscode调试react-native-web?

我试图找到如何调试react-native-web应用程序(特别是使用Expo和vscode)。

我既没有在网络上也没有在react-native-web自己的网站上找到指导。

React Native Tools附带的调试配置旨在在 Expo 应用程序中运行,但我的目的是使用浏览器来调试/测试 React-Native-Web 行为。

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug in Exponent",
            "request": "launch",
            "type": "reactnative",
            "cwd": "${workspaceFolder}",
            "platform": "exponent",
            "expoHostType": "local"
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

react-native react-native-web expo react-native-debugger react-native-tools

4
推荐指数
1
解决办法
1901
查看次数