Plugins: Duplicate export error for CommonJS

Created on 17 Nov 2020  路  2Comments  路  Source: rollup/plugins

  • Rollup Plugin Name: plugin-commonjs
  • Rollup Plugin Version: 16.0.0
  • Rollup Version: 2.33.22

Example module:

dep.cjs

exports.init = void 0;
function init () {
}
exports.init = init;

main.mjs

import test from './test.cjs';
test.init();

Built with:

rollup --plugin @rollup/plugin-commonjs main.mjs

Expected Behavior

Should build correctly.

Actual Behavior

RollupJS reports the following error:

node_modules/es-module-lexer/dist/lexer.cjs (13:19)
11: export { parse_1 as parse };
12: export { init_1 as init };
13: export { init_2 as init };
                       ^
Error: Duplicate export 'init' (Note that you need plugins to import files that are not JavaScript)
t鹿 馃悶 bug 馃攲 plugin-commonjs

Most helpful comment

Fixed in #537

All 2 comments

Fixed in #537

Great, let's get that deployed please :)

Was this page helpful?
0 / 5 - 0 ratings