首页 > 解决方案 > 使用汇总转换后看不到 jsdoc 方法建议

问题描述

目前,我们正在使用具有 cjs 格式的汇总 js 导出我们的 sdk 库,以使用命名导出进行转换。

汇总配置文件如下所示:

module.exports = {
  input: "src/index.js",
  output: [
    {
      // we only supports browser environment
      file: "build/bundles/bundle.cjs.js",
      format: "cjs",
      sourcemap: true,
      name: "client",
      exports: "named",
    },
    {
      file: "build/bundles/bundle.iife.js",
      format: "iife",
      name: "client",
    } 
  ],
  plugins: [
    globals(),

    babel({
      babelHelpers: "runtime",
      exclude: "node_modules/**", // Only transpile our source code
    }),
    resolve({
      browser: true,
      preferBuiltins: true,
    }),
    commonjs(),
    banner(copyright),
  ],
};

编译完成后,我们得到如下内容: 在此处输入图像描述

完美运行,但在转换后它不显示方法签名: 在此处输入图像描述

没有转译的预期结果: 在此处输入图像描述

任何人都知道为什么在编译我们的源代码后缺少我们的 jsdoc 签名?谢谢。

标签: sdkbabeljscommonjsrollupjsiife

解决方案


推荐阅读