wojtekmaj / react-pdf

Display PDFs in your React app as easily as if they were images.
https://projects.wojtekmaj.pl/react-pdf
MIT License
9.24k stars 877 forks source link

Do not ship `src` folder in published package #1587

Closed BreakBB closed 1 year ago

BreakBB commented 1 year ago

Before you start - checklist

Description

Currently the entire src folder is shipped together with the dist folder.

Is there a reason for this? From my experience it is quite unusual to ship the code in the npm package.

Proposed solution

Remove this line:

https://github.com/wojtekmaj/react-pdf/blob/459c15b545d25ef382470c749c7afd6de54b214c/package.json#L106

This reduces the package size by ~35% (106kb -> 68kb) and will have a similar result for the unpacked module.

Alternatives

No response

Additional information

No response

wojtekmaj commented 1 year ago

quite unusual

Not a standard practice, but many npm packages do this. @babel/core ships one, webpack does…

The main reasons for shipping src are:

I doubt 40 kB is a problem. Especially since pdfjs-dist, dependency we use, takes 31.1 MB in my node_modules folder.

BreakBB commented 1 year ago

I didn't thought about it that way, thank you for the answer 👍🏻