Skip to content

taro rn端sourcemap文件无法正常解析 #18669

@crise1993

Description

@crise1993

请先确认

  • 我已搜索并确定这个提交不是重复的

Taro 版本

v3

相关领域

None

使用框架

React

相关平台

  • 所有平台
  • Web 端(H5)
  • 移动端(React-Native)
  • 鸿蒙(Harmony)
  • 鸿蒙容器(Harmony Hybrid)
  • ASCF 元服务
  • 快应用(QuickApp)
  • 所有小程序
  • 微信小程序
  • 企业微信小程序
  • 京东小程序
  • 百度小程序
  • 支付宝小程序
  • 支付宝 IOT 小程序
  • 头条小程序
  • QQ 小程序
  • 钉钉小程序
  • 飞书小程序
  • 快手小程序

小程序基础库版本

No response

问题描述

使用taro 3.6.30版本构建rn端,并且生成sourcemap文件,但是生成的sourcemap文件无法解析堆栈。

解析出错:Error parsing mappings (code 1): the mappings contained a negative line, column, source index, or name index

复现链接

复现步骤

  1. rn端添加配置:
    rn: {
    output: {
    android: 'dist/rn/android/index.bundle.js',
    androidAssetsDest: 'dist/rn/android',
    androidSourceMapUrl: '',
    androidSourcemapOutput: 'dist/rn/index.android.bundle.map',
    androidSourcemapSourcesRoot: '',
    ios: 'dist/rn/ios/index.bundle.js',
    iosAssetsDest: 'dist/rn/ios',
    iosSourceMapUrl: '', // sourcemap 文件url
    iosSourcemapOutput: 'dist/rn/index.ios.bundle.map',
    iosSourcemapSourcesRoot: '',
    },
    }

  2. 页面添加监控
    global.ErrorUtils.setGlobalHandler((error, isFatal) => {
    defaultErrorHandler(error, isFatal);
    // todo错误上报
    })
    通过 错误上报收集到的error.stack报错信息
    onClick@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:1604:397 onPanResponderRelease@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:1042:2504 o@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:397:3072 onResponderRelease@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:397:2187 o@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:70:140 h@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:70:266 g@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:70:303 S@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:70:614 Ne@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:70:14260 forEach@[native code] Y@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:70:5281 /data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:70:14605 Pe@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:70:98108 Ce@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:70:14070 Le@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:70:14439 receiveTouches@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:70:15231 value@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:55:3805 /data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:55:676 value@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:55:2511 value@/data/user/0/com.ganji.android.haoche_c/app_rn_wvcache/guazi-fe__ucenter-taro__andriod/index.bundle.js:55:647 value@[native code]

  3. 通过sourcemap解析工具,解析上传的sourcemap报错
    https://mingle98.github.io/work.github.io/sourceMapTool.html

Image Image 用纯rn写的项目中,可以正常解析 Image

环境信息

👽 Taro v3.6.30

  Taro CLI 3.6.30 environment info:
    System:
      OS: macOS 15.5
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 20.18.1 - ~/.nvm/versions/node/v20.18.1/bin/node
      Yarn: 1.22.22 - ~/.nvm/versions/node/v20.18.1/bin/yarn
      npm: 10.8.2 - ~/.nvm/versions/node/v20.18.1/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.30 => 3.6.30 
      @tarojs/components: 3.6.30 => 3.6.30 
      @tarojs/components-rn: 3.6.30 => 3.6.30 
      @tarojs/helper: 3.6.30 => 3.6.30 
      @tarojs/plugin-framework-react: 3.6.30 => 3.6.30 
      @tarojs/plugin-platform-alipay: 3.6.30 => 3.6.30 
      @tarojs/plugin-platform-h5: 3.6.30 => 3.6.30 
      @tarojs/plugin-platform-jd: 3.6.30 => 3.6.30 
      @tarojs/plugin-platform-qq: 3.6.30 => 3.6.30 
      @tarojs/plugin-platform-swan: 3.6.30 => 3.6.30 
      @tarojs/plugin-platform-tt: 3.6.30 => 3.6.30 
      @tarojs/plugin-platform-weapp: 3.6.30 => 3.6.30 
      @tarojs/react: 3.6.30 => 3.6.30 
      @tarojs/rn-runner: 3.6.30 => 3.6.30 
      @tarojs/rn-supporter: 3.6.30 => 3.6.30 
      @tarojs/runtime: 3.6.30 => 3.6.30 
      @tarojs/runtime-rn: 3.6.30 => 3.6.30 
      @tarojs/shared: 3.6.30 => 3.6.30 
      @tarojs/taro: 3.6.30 => 3.6.30 
      @tarojs/taro-loader: 3.6.30 => 3.6.30 
      @tarojs/taro-rn: 3.6.30 => 3.6.30 
      @tarojs/webpack5-runner: 3.6.30 => 3.6.30 
      babel-preset-taro: 3.6.30 => 3.6.30 
      eslint-config-taro: 3.6.30 => 3.6.30 
      expo: ~47.0.3 => 47.0.14 
      react: ^18.1.0 => 18.3.1 
      react-native: ^0.70.5 => 0.70.15

开源贡献

Metadata

Metadata

Assignees

No one assigned

    Labels

    F-reactFramework - ReactT-rnTarget - 编译到 React NativeV-3Version - 3.xbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions