reading-time icon indicating copy to clipboard operation
reading-time copied to clipboard

Bloated browser bundle because of barrel file

Open FabianKoder opened this issue 7 months ago • 0 comments

Hi, thanks for this great library. After analysing our bundle we found that including reading-time via ESM imports as recommended causes several node dependencies (namely stream) to be included when building our Next.js app. My best guess would be that this is because the main barrel file imports the stream version as well and that import breaks treeshaking. This could be fixed multiple ways, probably the most low effort way would be creating two additional different barrel files (e.g. reading-time/browser and reading-time/node) that only export the necessary stuff.

FabianKoder avatar May 27 '25 14:05 FabianKoder