I have a working Rails 7 app that uses esbuild as the JS bundler and have imported bootstrap.
I am trying to figure out how to a access any Bootstrap Javascript functionality 'outside' the main application.js file - i.e. let's say I wanted to programatically show a Bootstrap modal on a particular page like this:
var myModal = new bootstrap.Modal(document.getElementById('helpModal'), {});
myModal.modal('show');
however this doesn't work as 'bootstrap' is not known:
Uncaught ReferenceError: bootstrap is not defined
...even though the page links in application.js:
<%= javascript_include_tag "application", defer: true %>
Any suggestions on how to access 'bootstrap' in JS outside application.js itself ?
Thank you !