Start your All-Access Pass to unlock this challenge
How can you make a controller from a UX package load lazily?
Add data-fetch="lazy" HTML attribute on the tag with the data-controller.
data-fetch="lazy"
data-controller
Add "fetch": "lazy" for the package in assets/controllers.json.
"fetch": "lazy"
assets/controllers.json
In assets/bootstrap.js, add:
assets/bootstrap.js
app.registerLazy('name-of-controller');
Add "lazy": true for the package in assets/controllers.json.
"lazy": true