[LRUG] Troubleshoot asset pipeline with webpacker

Ed James ed.james.spam at gmail.com
Fri May 26 01:06:18 PDT 2023


Thanks everyone! We actually managed to get it under control and brought this CI build step down from 7 mins to around 2.5 mins. We found this article to be extremely useful and enlightening:

https://rossta.net/blog/overpacking-a-common-webpacker-mistake.html
Hopefully that helps someone else too.

Best,


 	Ed James 
I will respect your spam <mailto:ed.james.spam at gmail.com>

> On 26 May 2023, at 05:35, Tomasz Pajor <nikon at puffy.pl> wrote:
> 
> I second what Fred wrote here. In a couple of cases, for me, it helped to switch from webpacker to jsbundling-rails, cssbundling-rails, and esbuild. You can do that if you are on rails >= 6.0. After that, and when you upgrade to 7.0, you can switch to propshaft. Each case is different, so I would have to see what you have in the code to help you. If you are still having issues, feel free to contact me.
> 
> On Fri, May 26, 2023 at 4:38 AM Frederick Cheung <frederick.cheung at gmail.com <mailto:frederick.cheung at gmail.com>> wrote:
>> 
>> Hi,
>> 
>>> On 23 May 2023, at 17:35, Ed James <ed.james.spam at gmail.com <mailto:ed.james.spam at gmail.com>> wrote:
>>> 
>>> We now have a build which consistently fails when compiling assets because of a RAM overflow i.e. we are suddenly exceeding our CircleCI RAM limit, which is 16GB!
>>> 
>> 
>> Does your assets have any js (or ts) .erb files? An app I used to work on had quite a lot of these (we used them to interpolate settings, I18n etc into the front end). Webpacker has to spawn a rails process for those and it will spawn many in parallel if you have lots of these files. Other than that the way we really got our asset compilation under control was switching to esbuild (via jsbundling). As Martin notes you can’t do some of the cleverer stuff this way (HMR, some of the dynamic chunking I think) but if you’re not very front end focussed you probably weren’t using them anyway!
>> 
>>> We’ve run out of experiments and seems to have exhausted all avenues for fixing this. We are primarily a back-end team so we have no specialist webpacker/asset-pipeline knowledge in the team.
>>> 
>>> If anyone is willing to have a brief chat to run through any other potential gotchas/options, I would greatly appreciate it.
>>> 
>>> I did find this article particularly interesting, but our lack of asset-pipeline knowledge limit us from progressing down this route (which seems promising): https://rossta.net/blog/overpacking-a-common-webpacker-mistake.html
>> 
>> Yes, this is easy enough to do by accident. The short version is that if all (or lots of your js) is in app/JavaScript/packs you’re probably guilty of that. The file(s) in there should be few and mostly just importing all of your code and bootstrapping your frontend code.
>> 
>> Not a frontend expert by any stretch of the imagination but happy to have a chat.
>> 
>> Fred
>> 
>>> 
>>> Thanks!
>>> 
>>> 
>>>  	Ed James 
>>> I will respect your spam <mailto:ed.james.spam at gmail.com>
>>> _______________________________________________
>>> Chat mailing list
>>> Chat at lists.lrug.org <mailto:Chat at lists.lrug.org>
>>> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
>>> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
>>> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>> _______________________________________________
>> Chat mailing list
>> Chat at lists.lrug.org <mailto:Chat at lists.lrug.org>
>> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
>> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
>> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> Archives: http://lists.lrug.org/pipermail/chat-lrug.org
> Manage your subscription: http://lists.lrug.org/options.cgi/chat-lrug.org
> List info: http://lists.lrug.org/listinfo.cgi/chat-lrug.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20230526/56a81f69/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: brandless-packing-unsplash.jpg
Type: image/jpeg
Size: 247289 bytes
Desc: not available
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20230526/56a81f69/attachment-0001.jpg>


More information about the Chat mailing list