-
-
Notifications
You must be signed in to change notification settings - Fork 334
Cleanup published versions #165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1 similar comment
In my understanding, including lock file increase the bundle size but reduce the installation time. So need to confirm if this is really helpful not to publish them. Moreover, in my opinion, bundle size matters when it is published to be used as a web version. |
First of all, if any lockfile is going to be included it should be the npm package-lock as the majority of the Node community uses npm and not yarn. I pray you don't need me to link half a dozen statistic tracking sites to back this as it's common sense. Secondly, the npm docs only state that the package lock should be included in version control (git) and not in the dist bundle (see: https://docs.npmjs.com/files/package-locks#using-locked-packages). There is no information at all on it "speeding up installs", not even for development environments. I have no idea where you got this information. Thirdly, if including the lockfile would improve end-user experience then wouldn't you think that big packages would include it? Don't answer that - they would. But the contrary couldn't be more true. By example here are screenshots for React, Angular and Moment: And lastly, while it's true that bundle sizes matter most for browser bundles there is still no reason to bloat the node_modules folder for Node users. You wouldn't put a .psd file you used for making logos in the dist either. |
I downloaded the published code and found hat it has only necessary files only. yarn.lock has been set not to be published from next release. Hence, I'm closing this PR. Thanks for the efforts you made. |
@amitguptagwl that would be because you guys added an npmignore file. However npmignore files are extremely suboptimal because the moment you add another file that is not including in the exclusions it gets added to the published version. Instead you should use the files field in package.json as I did with this PR and rather than specifying which files to ignore, specify which files to include - which is 99/100 times a way smaller amount. |
I didn't see even nppignore and other config files in published package.
The advantage of npmignore is that you don't pollute package.json for
everything ang package size is more smller.
…On Sat, 16 Nov 2019, 17:51 Jeroen Claassens, ***@***.***> wrote:
@amitguptagwl <https://github.com/amitguptagwl> that would be because you
guys added an npmignore file. However npmignore files are extremely
suboptimal because the moment you add another file that is not including in
the exclusions it gets added to the published version. Instead you should
use the files field in package.json as I did with this PR and rather than
specifying which files to ignore, specify which files to include - which is
99/100 times a way smaller amount.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#165?email_source=notifications&email_token=AB2WAKDGKOJDIC7VXNSVRBLQT7QU5A5CNFSM4HR7IXQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEHQHTI#issuecomment-554632141>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB2WAKAAPXQ34YEY4HMOAJ3QT7QU5ANCNFSM4HR7IXQQ>
.
|
Purpose / Goal
I noticed that the version published to NPM has some remaining unnecessary files. This is sort of the issue when using
npmignore
as you're specifying which files not to publish which requires maintaining it. Instead it's far better to use thefiles
property inpackage.json
where you specify which files you do want.Shown below are the before and after of
npm publish --dry-run
. As you can see just removing the remaining files ensures a times 5 decrease of bundle size (from 106.7 kB to 22.1 kB!), primarily due to filtering out the lockfile which does nothing for NPM installs.Before:
After:
Type
Please mention the type of PR