Vanta.js not reloading after GSAP & Barba JS transition

Ok so I got a Vanta.js background running in my <main> which looks awesome. Then I introduced a page transition using Barba and GSAP for animations, which are working fine too. But after going back to my index I found that VantaJS isn’t loading again. There are very few questions about Barba and even less answered correctly.

Here’s what I’ve tried until now:

  • Use window.onload with appendChild to add the vanta libraries each time.
  • Use Barba hooks to reload the libraries on “after” hook.
  • Send all scripts to the bottom of my html in correct order.

Here are some SO questions I’ve used as example:

How to reinit custom js files between pages (Barba.js)?

Scripts are not loading after the page transition in Barba.jS

JS content not working after a page transition using Barba.JS

No luck implementing any of these.

I’m open to other transition libraries if you think that Barba is the problem definitely.
Thanks in advance.