Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It appears that they used Webpack, which I found interesting given other alternatives.


The UI package appears to use Rollup.

And this looks like the PR for the icons update: https://github.com/Linen-dev/linen.dev/pull/1001


they had to change every import for an icon in 60 files. Wouldn’t it have been better if a PR was done against Rollup to fix this “bug”? probably much more difficult/not possible?


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)


Many javascript programmers including library authors don't understand the tree shaking mechanisms available to them. Setting the "sideEffects" property in package.json can be very effective in detailing whether to include/exclude an entire module or certain source files:

https://webpack.js.org/guides/tree-shaking/#mark-the-file-as...

All popular bundlers (webpack, rollup, esbuild) respect that field.


A commuter typically takes a free public bus ride to work. The bus broke down this morning. The commuter had to go out of their way to take a different bus to get to work. Wouldn’t it have been better if they stayed and fixed the first bus?


I get the proverb but you have to admit that it's kind of a big deal that a tree-shaker bundler optimizer has a pretty big glaring known broken issue with it where it doesn't bundle.

The bus gets fixed eventually. This doesn't (unless somebody fixes it).


I don't think the bus will get fixed unless somebody fixes it either.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: