Hacker News new | ask | show | jobs
by WorldMaker 1153 days ago
It may not be a "bug" in rollup.

Unfortunately, the current state of ESM in Node is such a mess that you can't assume most packages are tree-shakeable. There is package.json metadata to do that.

It's more likely to be a "simple" bug (with far reaching consequences) in react-icons' package.json and/or build process.

Taking a quick glance at https://github.com/react-icons/react-icons/blob/master/packa...

Yeah, it's using the old non-standardized "module" field as opposed to the modern and mostly standard (now at least) "exports" field [1] or "type" field.

"exports" would be a quick fix of the existing package.json file with no other changes to the build process, but given this is a UI package intended primarily for browser usage I'm having a hard time understanding why it bothers to include CommonJS at all and isn't just `"type": "module"` and remove CommonJS from the build entirely.

That probably points to why this hasn't been done yet: it gets into a bikeshed argument and a lot of potential discussion on big changes to a presumably "not broke" build system.

[1] https://nodejs.org/api/packages.html#packages_exports

(ETA: Existing Issue on this subject in that repo: https://github.com/react-icons/react-icons/issues/717)