question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[slice-machine-ui@0.1.0-alpha.6]: Released package is way too large (over 100 MiB in size)

See original GitHub issue

Version

  • 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): image

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:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
hypervillaincommented, Jun 24, 2021

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

2reactions
lihbrcommented, Jun 24, 2021

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 🤔

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Slice Machine - Developing with Prismic
First: Check Your Versions. The current working versions are here: slice-machine-ui : https://www.npmjs.com/package/slice-machine-ui. prismic- ...
Read more >
RFC(slice-machine-ui): use/configure custom mocks · Issue #58
I've been building a small prototype that tries to address them: Basically, it expects a .slicemachine/mocks.json file (that I create manually ...
Read more >
slice-machine-ui - npm
A visual builder for your Slice Models with all the tools you need to generate data models and mock CMS content locally.
Read more >
Step-by-step guide on how to create your first slices with Slice ...
Step-by-step guide on how to create your first slices with Slice Machine for the #SliceContestMore info about the SliceContest: ...
Read more >
Creating a Project With Slice Machine & Next.js - YouTube
Today Alex is presenting how to set up Slice Machine with Next.js in order to start developing slices - website sections - with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found