1

I have an Angular 13 and webpack project with about 350 megs of mp3 and mp4 files. I now have 6 directories in project-dir.angular\cache\angular-webpack each almost a gig in size. The directories date back a month.

I can easily delete the old versions, but my goal would be for ng serve to not add all of the mp3/mp4 files to the cache each time I serve the project, which would take 350 megs out of the total size. It's filling up my hard drive at work (it's an older ssd, so limited space) and there's no reason to keep a cache of these files.

Any information on controlling this cache? At the very least, it only needs to keep one version at a time, not half a dozen going back a month. I'm not sure if this is an angular setting or a webpack setting.

Thanks!

Bob Ramsey
  • 547
  • 1
  • 6
  • 13
  • 1
    If your talking about webpack’s filesystem cache and angular 12 new option NG_PERSISTENT_BUILD_CACHE you can edit the start script and disable the cache: "start": "NG_PERSISTENT_BUILD_CACHE=0 ng serve", – Danail Videv Jan 03 '22 at 16:55
  • @danvid - Yes, I think that is it. That turns the whole cache off though, right? It's all or nothing. I was hoping for a way set a list of files not to cache, something like `{ cacheOptions: { excludePaths: ['./assets', './videos', './media/**/*.jpg'], excludeFiles: [ '*.mp4', '*.mp3', '*.png'] } }` – Bob Ramsey Jan 04 '22 at 20:49
  • 1
    Yes will turn off the whole webpack file cache.You can playaround with custom webpack builder and webpack config file https://webpack.js.org/configuration/cache/#cache – Danail Videv Jan 05 '22 at 08:00
  • I think because you commented I can't flag these as the right answer. Maybe. – Bob Ramsey Jan 05 '22 at 14:42

1 Answers1

0

Different aspect of this issue -- locally we have a project that developed TFS check-in issues. It wants to include all webpack files.

Of course we just exclude the .angular folder from check in for this.

But what about purging automatically all files no longer relevant? This is a huge amount of space to use up.

The most current angular cli is installed. how about some tips on more granular control of the creation, maintaining of these files and cache?

user1585204
  • 827
  • 1
  • 10
  • 14