代码之家  ›  专栏  ›  技术社区  ›  dsenese

即使tsconfig.json中的sourceMaps为false,Parcel也不会停止发射Source Maps

  •  0
  • dsenese  · 技术社区  · 2 年前

    我正在使用ParcelJS v2.8.3构建Web扩展,因为bundler和Parcel保持发出内联源映射,即使tsconfig明确地告诉不要发出或在.map.js文件中单独发出。

    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或任何其他文件

    "use strict"; # my code...
    //# 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"]
      }
    }
    
    0 回复  |  直到 2 年前
    推荐文章