Webpacker: Compiled files in public/packs taking a LOT of disk space.

Created on 7 Dec 2017  路  2Comments  路  Source: rails/webpacker

I'm currently using webpacker 3.0.2 with Rails 5.1.4 on Windows Subsystem for Linux (WSL).

I recently realized that everytime I've made a change to one of my JavaScript files (and subsequently re-compiled) the previous copies of "application-XXX.js and server_rendering-XXX.js" are being kept in "public/packs".

When I realized this I had 1.6gb of data from all the copies of this pair of files that were made from each change.

webpacker_compiled_files

Is this normal? If so, is there a setting that could wipe them out automatically? If not, is this perhaps something to do with WSL?

Most helpful comment

Alright. that's a fix if/when the rails server gets a restart, but is there a way to do this automatically? I can go several hours editing code and creating many bundles.

I've seen plugins like webpack-clean-obsolete-chunks, but I'm unsure if they work with webpacker or if how to implement them if they do.

All 2 comments

@cynicalsubject Perhaps you would like to run clobber before starting servers. bundle exec rails webpacker:clobber

Alright. that's a fix if/when the rails server gets a restart, but is there a way to do this automatically? I can go several hours editing code and creating many bundles.

I've seen plugins like webpack-clean-obsolete-chunks, but I'm unsure if they work with webpacker or if how to implement them if they do.

Was this page helpful?
0 / 5 - 0 ratings