firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

incredibly huge package size (687MB)

Open xr0master opened this issue 2 years ago • 10 comments

Hi. The package size is greater than the size of all other packages in the sum for each project.

[REQUIRED] Environment info

firebase-tools: 10.6.0

Platform: macOS

[REQUIRED] Test case

du -sh node_modules/* | sort -hr

Screen Shot 2022-04-14 at 9 22 03 PM

xr0master avatar Apr 14 '22 18:04 xr0master

This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Apr 14 '22 18:04 google-oss-bot

Have you tried npm install firebase-tools --only=prod? That will exclude the dev dependencies.

yuchenshi avatar Apr 18 '22 20:04 yuchenshi

@yuchenshi the --only=prod will exclude all dev dependencies of the project.

xr0master avatar Apr 18 '22 20:04 xr0master

That's what npm install should be doing anyway. It's because of the shrinkwrap file (I think) that it's installing the dev dependencies as well. To use the CLI (or the CLI as a module), the dev dependencies aren't required in the slightest.

npm actually has an open issue discussing this, though it's not exactly active. Maybe worth someone from our side tilting at npm to see if it can be addressed.

bkendall avatar Apr 18 '22 20:04 bkendall

(but, unfortunately, outside some really, really hacky stuff on our end, this is really an npm issue)

bkendall avatar Apr 18 '22 20:04 bkendall

https://github.com/npm/cli/issues/4323 is the issue I should have linked. That's the one with actual activity.

bkendall avatar Apr 18 '22 21:04 bkendall

Perhaps it would be possible to have a prepublishOnly script that strips the dev dependencies from npm-shrinkwrap.json as a workaround?

haines avatar Apr 27 '22 08:04 haines

@haines for my projects (PostCSS, Browserslist) I use clean-publish to cut development configs during the release.

ai avatar Apr 27 '22 11:04 ai

@xr0master For reproducibility, may I suggest you add to the description the way you installed firebase-tools.

I am using

yarn global add --ignore-optional firebase-tools@${FIREBASE_TOOLS_VERSION} \
  && yarn cache clean

..within a Dockerfile, and it provides no problems (node_modules/* is 99.8MB). I think the official guidance was using yarn at the time I have read it.

akauppi avatar Jul 05 '22 09:07 akauppi

@akauppi npm i firebase-tools --save-dev

xr0master avatar Jul 05 '22 09:07 xr0master

I gave up waiting for npm to fix their issues and am using clean-publish to do this now. So, thanks for the tip to that @ai (nice username)

Fixed by #5023

bkendall avatar Sep 27 '22 23:09 bkendall

before image after image

Still a bit thick, but 4 times smaller! Great job, thanks a lot @bkendall.

xr0master avatar Sep 28 '22 20:09 xr0master

GASP! I had the thought of "I wonder what's bloating that so" and discovered that googleapis is listed as a dependency but really is a dev dependency... and it's 111MB.

bkendall avatar Sep 28 '22 20:09 bkendall