rollup / rollup-plugin-commonjs

This module has moved and is now available at @rollup/plugin-commonjs / https://github.com/rollup/plugins/blob/master/packages/commonjs
MIT License
502 stars 126 forks source link

No AST node created for wrapper itself #286

Closed guybedford closed 6 years ago

guybedford commented 6 years ago

The wrapper in https://github.com/rollup/rollup-plugin-commonjs/blob/master/src/transform.js#L360 should ideally also have a corresponding representation in the AST returned in order to properly retain the invariants of the transformation process.

Not having this results in the variable assignment not being exported when outputting to the system module format, which requires rendering on the assignment identifier of the export default AST node to be applied.

guybedford commented 6 years ago

The alternative workaround here could be to somehow detect the system output format and add the exports('exportName', ...) to the wrapper assignment manually...

guybedford commented 6 years ago

It seems I got this wrong - was under the impression this plugin was returning the AST for use in Rollup, but it seems like that isn't the case due.