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

ParcelJS v2.8.3无视tsconfig配置仍生成内联Source Maps求助

ParcelJS v2.8.3构建Web Extension时Source Map配置不生效

我正在使用ParcelJS v2.8.3作为打包工具构建Web Extension,但遇到了Source Map配置不生效的问题:无论在tsconfig.json里明确设置关闭Source Map,还是配置生成单独的.map.js文件,Parcel始终会生成内联Source Map。

我的tsconfig.json相关配置如下:

"sourceMap": false,                                /* Create source map files for emitted JavaScript files. */
//"inlineSourceMap": false,                          /* Include sourcemap files inside the emitted JavaScript. */
//"inlineSources": false,                            /* Include source code in the sourcemaps inside the emitted JavaScript. */

打包后的background.js等文件末尾仍带有内联Source Map标识:

"use strict"; // 我的代码...
//# sourceMappingURL=data:application/json....

即使我将sourceMap设为true,取消注释并设置inlineSourceMap和inlineSources为false,结果依旧不符合预期:既不会生成单独的.map.js文件,也无法移除内联的源码内容。

我已经尝试过以下操作,但问题仍未解决:

  • 删除.parcel-cache文件夹
  • 安装@parcel/transformer-typescript-tsc

我的.parcelrc配置如下:

{
  "extends": "@parcel/config-webextension",
  "transformers": {
    "*.{ts,tsx}": ["@parcel/transformer-typescript-tsc"]
  }
}

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.24 00:32:07