[slice-machine-ui@0.1.0-alpha.6]: Released package is way too large (over 100 MiB in size)
See original GitHub issueVersion
- Prismic CLI version:
prismic-cli/4.0.1-alpha.10 wsl-x64 node-v16.3.0
- SliceMachine version:
slice-machine-ui@0.1.0-alpha.6
Reproduction
yarn
Add slice-machine-ui@0.1.0-alpha.6
to a bare yarn 2 package:
mkdir slice-machine-package-size-yarn
cd slice-machine-package-size-yarn
yarn init
yarn set version berry
echo "nodeLinker: node-modules" >> .yarnrc.yml
yarn add -D slice-machine-ui@0.1.0-alpha.6
Inspect package size in .yarn/cache
:
du -h .yarn/cache/slice-machine-ui-npm-0.1.0-alpha.6-*.zip
npm
Add slice-machine-ui@0.1.0-alpha.6
to a bare npm package:
mkdir slice-machine-package-size-npm
cd slice-machine-package-size-npm
npm init
npm install -D slice-machine-ui@0.1.0-alpha.6
Inspect package size in node_modules
:
du -h node_modules/slice-machine-ui
What is expected?
Yarn 2 compresses and caches dependency sources in the project’s .yarn/cache
directory. In this format, most runtime dependencies are a few KiB and developer tools do not exceed 10 MiB. As such, slice-machine-ui
should be at most a few MiB when cached by yarn 2.
What is actually happening?
slice-machine-ui
is considerably larger than any other development dependency. In the above mentioned .yarn/cache
format, slice-machine-ui@0.1.0-alpha.6
sits at 136 MiB, which is many times larger than any other development tool in the workspace. This is also reflected in install times amongst others.
When using npm, the equivalent node_modules/slice-machine-ui
is 585 MiB.
Any additional information
slice-machine-ui@0.1.0-alpha.6
seems to have been released with ALL of its build artifacts packaged with the source, as would be done with an application, but this is not really appropriate for dependencies. This is all based on what I found inspecting the yarn cache archive of the package. npm’s node_modules
exhibits similar behavior.
The current size of the package is very limiting and has caused some issues in our pipeline. Yarn 2’s dependency cache is typically uploaded to repositories to amend lockfiles for improved CI/CD performance and other developer experience improvements. We currently have to exclude the package from being uploaded to our repository, which accounts for more than half of our dependency cache on a moderately sized monorepo.
## Yarn Berry
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
## Oversized dependencies
.yarn/cache/slice-machine-ui-npm-0.1.0-alpha.6-40952b27f7-5861a0b0b9.zip
The size of the package might also be related to incomplete dependency installations in Docker containers, although we are still investigating that.
For reference, in our production monorepo, these are the largest dependencies and their sizes (see disk usage of all cache files):
BTW, thank you for the awesome work you have been doing on SliceMachine and Prismic’s JavaScript/TypeScript SDK! We are currently running all of your latest alphas and really appreciate the new direction you are taking your libraries.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top GitHub Comments
Good catch, we introduced a wrong build step when moving to TypeScript. This should be better-ish https://www.npmjs.com/package/slice-machine-ui/v/0.1.0-alpha.9
Hey @zalanlevai, thanks for the detailed report, we will investigate! I’m also quite excited about the work moving forward on our other kits ☺️
@hypervillain I started a bit and looks like already
./build/client
doesn’t need to be shipped, already shaving 393 MB out of the 461 MB it takes on my disk, last big bite remaining being the./out
directory (55.7 MB on my disk) I’m not sure what we can share from it though, being the built Next webapp 🤔