You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在WSL的VSCode中调试Firebase应用时断点变灰问题

Windows下WSL2环境中VSCode调试Firebase应用断点无效问题

我在Windows系统的Ubuntu WSL2环境下,使用VSCode通过断点调试Firebase应用时遇到异常:设置断点后按F5启动调试,调试器已成功附加,但断点显示为灰色,鼠标悬停时提示无法找到对应的源位置。

我通过firebase emulators:start --inspect-functions命令启动模拟器,浏览器可正常访问http://127.0.0.1:5000测试应用。

调试排查时发现,系统识别的断点路径为/home/christoph/dev/translator-poc/src/index.js第17行第1列,但找不到对应源位置,仅发现多个同名文件。

项目使用webpack将/src目录编译到/public目录,相关配置文件如下:

launch.json配置

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "attach",
            "name": "Attach",
            "port": 9229,
            "restart": true,
            "skipFiles": ["<node_internals>/**"]
        }
    ]
}

webpack.config.js配置

const path = require('path');

module.exports = {
  // The entry point file described above
  entry: './src/index.js',
  // The location of the build folder described above
  output: {
    path: path.resolve(__dirname, 'public'),
    filename: 'bundle.js'
  },
  // Optional and for development only. This provides the ability to
  // map the built code back to the original source format when debugging.
  devtool: 'eval-source-map',
};

firebase.json配置

{
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  },
  "emulators": {
    "singleProjectMode": true,
    "hosting": {
      "port": 5000
    },
    "ui": {
      "enabled": false
    },
    "firestore": {
      "port": 8080
    },
    "functions": {
      "port": 5001
    }
  },
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "functions": [
    {
      "source": "functions",
      "codebase": "default",
      "ignore": [
        "node_modules",
        ".git",
        "firebase-debug.log",
        "firebase-debug.*.log"
      ],
      "predeploy": [
        "npm --prefix \"$RESOURCE_DIR\" run lint"
      ]
    }
  ]
}

相关版本信息

  • VSCode版本:1.74.0
  • Firebase版本:11.17.0
  • Node.js版本:v16.4.0
  • Java版本:openjdk version "19.0.1" 2022-10-18 / OpenJDK Runtime Environment (build 19.0.1+10-Ubuntu-1ubuntu122.04)

内容的提问来源于stack exchange,提问作者Christoph

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.08 11:55:18