-
Notifications
You must be signed in to change notification settings - Fork 710
Description
What problem does this feature solve?
I'm working on a universal visualizer and analyzer for JavaScript and CSS called Sonda, which already supports Rollup and Vite (among other bundlers). The reports it generates include information about how much code in a given bundle was ESM or CJS.
In Rollup this was fairly easy to check in the moduleParsed hook because the @rollup/plugin-commonjs plugin adds the module.meta.commonjs.isCommonJS property to all CJS modules. However, since Rolldown comes with built-in support for CommonJS and this plugin is no longer needed, there is no way (at least that I'm aware of) to get this information.
What does the proposed API look like?
Probably the best approach would be to add the module.meta.commonjs.isCommonJS property to CommonJS modules to maintain backward compatibility with Rollup.