What is the .cache folder in parcel-bundler? Is it necessary to push the .cache folder to Github?
Asked Answered
S

4

10

What is the .cache folder in parcel-bundler? Is it necessary to push the .cache folder to Github ?

Southport answered 15/3, 2020 at 17:36 Comment(0)
A
21

The .cache folder (or .parcel-cache in parcel v2) stores information about your project when parcel builds it, so that when it rebuilds, it doesn't have to re-parse and re-analyze everything from scratch. It's a key reason why parcel can be so fast in development mode. I think committing it to git would be a bad idea - it would add a large number of (unnecessary) changes to your commit history, and it could easily get out-of-sync with the code that generated it.

From this article:

Be sure to add .cache and dist to your .gitignore file to prevent committing these folders to Git. The .cache folder is used by Parcel as a temporary cache directory when building your app for development and production.

Aftertime answered 17/3, 2020 at 14:4 Comment(0)
B
3

A slight update on this answer, although it is practically the same response, would be that the command you now need to enter for parcel@^2.0.0-beta.1 is:

.parcel-cache

Add this to your .gitignore file and all the Blobs will be removed from your Untracked listed of files when you hit git status again.

Thank you for helping me resolve this issue!

Broider answered 15/12, 2020 at 14:11 Comment(5)
Yes, parcel@^2.0.0-beta.1 now has .parcel-cache. I have .cache added to my .gitignore in my one-year old project bundled with parcel but I have .parcel-cache.Mccue
I can see that parcel-bundler/.gitignore file at github.com/parcel-bundler/parcel/blob/v2/.gitignore still has both .parcel-cache and .cache, should we still keep .cache in our .gitignore?Mccue
I can't see any reason not to, as in my mind it would make the application backwards compatible, and ensure your Git commit are not full of cached files from your .cache file, but I would defer to somebody else to provide a technical in-depth answer on why you should keep it.Broider
when I added .parcel-cache and .cache to my gitignore , the folders do not get ignored?Bewail
@kickbuttowski Did you do :wq after adding those files? This will write the change and quit vim. Input I to begin inserting changes to the file you open in vim. You can open files in vim using vim [filename] as your command.Broider
S
0

no it is not necessary to add parcel-cache in git. one should add parcel-cache in git-ignore because parcel-cache is the space taken by parcel during production building its a binary files .This can be made again after deleting cache with a command npm run build

Scorekeeper answered 16/2, 2023 at 11:55 Comment(0)
N
0

The Parcel cache is beneficial for developers because it reduces the time it takes to build or rebuild a project, making the development workflow more efficient. This feature is particularly valuable when working on large projects or when using Parcel's development server with hot module replacement (HMR), as it allows for near-instant updates as you make changes to your code.

Noles answered 4/9, 2023 at 21:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.