babel-plugin-transform-commonjs icon indicating copy to clipboard operation
babel-plugin-transform-commonjs copied to clipboard

Support importsOnly option

Open taras opened this issue 2 years ago • 1 comments

Thank you for creating this transform. It's helpful on a project where we're using Relay Modern (11). Relay generates TypeScript modules that for some reason occasionally include require statements. We're using this transform to make these modules pure ES6 modules.

In our case, we're finding the export feature to be unhelpful because it creates multiple default exports. We get something that looks like this,

export default node;
export default module.exports;

export default module.exports is added by this transform but unnecessary.

It would be very helpful if it was possible to only change the import statements but not add the exports.

taras avatar Nov 30 '21 15:11 taras

Hi sorry, only just now saw this. If we solved the issue with multiple default exports, would that be sufficient vs adding the importsOnly option?

tbranyen avatar Jan 05 '22 01:01 tbranyen