通过汇总保留独立注释

时间:2019-11-26 05:26:03

标签: rollupjs

我试图通过汇总保留尾随的独立注释。我简要地介绍了如何通过插件扩展汇总,或者深入研究AST,但是正在寻找有关可能解决方案的指南。

输入

// Some comment

const foo = {};

// Another comment <-- I want this to remain

export { foo };

输出

(function (exports) {
    'use strict';

    // Some comment

    const foo = {};

    exports.foo = foo;

    return exports;

}({}));

汇总配置

export default [
  {
    input: "src/index.js",
    plugins: [],
    output: {
      file: "dist/index.js",
      format: "iife",
      name: "foo"
    },
    treeshake: false
  }
];

0 个答案:

没有答案