Javascript deferreed import #86
Unanswered
Vorkosigan76
asked this question in
Q&A
Replies: 2 comments 2 replies
-
@Vorkosigan76 could you just have another file, like <%= javascript_include_tag "fontawesome", defer: true %> |
Beta Was this translation helpful? Give feedback.
1 reply
-
You're options are either to defer the whole bundle or to separate out fontawesome with its own file and defer that. But I'd just defer the whole bundle. That's also the new form for ESM in the browser. Everything included as a module is deferred by default. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In order to load a js library, you need to add an import request to application.js like this
import "@fortawesome/fontawesome-free/js/all.js"
However some Javascript libraries require a deferred import such as this
<script src="all.js" defer></script>
The reason for this is that this code executes when loaded and requires the page to be fully loaded.
=> Is there a way to do that with jsbundling?
Beta Was this translation helpful? Give feedback.
All reactions