This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
vite_legacy_javascript_tag execution order inconsistent with vite_javascript_tag #104
Labels
enhancement
New feature or request
Description 📖
When using multiple endpoints on one page with
vite_legacy_javascript_tag
doesn't preserve execution order. I think this is because under the hood it just runsSystem.import(document.getElementById('#{ id }')
behind the scenes which doesn't guarantee any execution order betweenvite_legacy_javascript_tag
since they are handled async and will just run in completion order.vite_javascript_tag
does however behave as expected this is because<script type="module">
will execute the endpoints in the order that they are defined in the html.I know that ideally we would only have 1 endpoint per page, but thats not a viable option for us since we have a lot of legacy code 😅
Reproduction 🐞
expected execution order: first_to_run, second_to_run
expected execution order for non-legacy browsers : first_to_run, second_to_run
expected execution order for legacy browsers : first_to_run, second_to_run or second_to_run, first_to_run
Run
bin/rake vite:info
and provide the output:Appreciation
Other than this issue, this gem has been awesome! It's really gonna help us out! Thanks 😄 👍
The text was updated successfully, but these errors were encountered: