Skip to content
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

Enable babel-loader cache, document webpack and babel-loader cache #990

Merged
merged 5 commits into from
Jun 5, 2024

Conversation

askoufis
Copy link
Contributor

@askoufis askoufis commented Jun 4, 2024

From the changeset:

Sku's webpack configuration now configues babel-loader to emit a cache to node_modules/.cache/babel-loader. The primary use case for this cache is speeding up production builds. It can also speed up local development in situations where the webpack cache is invalidated.

The emitted cache files take up a relatively small amount of space (10s of MBs, and the compress quite well), making it much more practical to cache on CI, relative to the webpack cache.

In a moderately-sized, internal monorepo, this cache dropped the sku build time in CI from an average of 4m 11s (across 5 builds) to an average of 3m 3s (across 5 builds). The cost of each cache file is roughly an extra 6s (saving and restoring the cache) and 8.3mb of storage.

Caching node_modules/.cache/babel-loader across all of sku's fixtures decreased test time by ~20s in sku's CI.

I've added docs for both this cache and the existing webpack cache in the Extra features docs. The docs are relatively high-level, and don't go into details on actually setting up a cache in CI.

@askoufis askoufis requested a review from a team as a code owner June 4, 2024 04:30
Copy link

changeset-bot bot commented Jun 4, 2024

🦋 Changeset detected

Latest commit: de199a1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
sku Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

with:
path: 'fixtures/*/node_modules/.cache/babel-loader'
key: babel-loader-${{ runner.os }}-${{ hashFiles('./pnpm-lock.yaml') }}
restore-keys: babel-loader-${{ runner.os }}-
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking, is the trailing "-" correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these examples have a trailing hyphen, so I'd say yes.

It's probably not required, I think the restore key is just meant to be a non-unique prefix of the key, so it would probably work without the - too.

askoufis and others added 2 commits June 5, 2024 09:26
Co-authored-by: Michael Taranto <michaeltaranto@users.noreply.github.com>
@askoufis askoufis enabled auto-merge (squash) June 5, 2024 02:02
@askoufis askoufis merged commit bf3fa1a into master Jun 5, 2024
4 checks passed
@askoufis askoufis deleted the enable-babel-loader-cache branch June 5, 2024 02:08
@seek-oss-ci seek-oss-ci mentioned this pull request Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants