I’ve encountered a scenario where Sage 9’s “route-based” approach for page-specific JS doesn’t quite fit the bill.
After perusing this Discourse, I couldn’t find a solid way to do full blown “code splitting” (whereby I break down my bundle into constituent parts/pages).
A simpler approach might be to only enqueue that particular JS file (written in ES6, using lots of
import statements) when that specific page loads. I’m unsure how to do that, though…