Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ids to the included legacy tags #252

Open
edumudu opened this issue Sep 6, 2022 · 3 comments
Open

Add ids to the included legacy tags #252

edumudu opened this issue Sep 6, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@edumudu
Copy link

edumudu commented Sep 6, 2022

Is your feature request related to a problem? Please describe.
This gem vite_plugin_legacy does not insert all the scripts generated by the @vitejs/plugin-legacy

Describe the solution you'd like
Also Insert the inline scripts inserted by the vite plugin

These are inserted in the head to load legacy build in esm browsers that not support dynamic-import

<script type="module">try{import("_").catch(()=>1);}catch(e){}window.__vite_is_dynamic_import_support=true;</script>
<script type="module">!function(){if(window.__vite_is_dynamic_import_support)return;console.warn("vite: loading legacy build because dynamic import is unsupported, syntax error above should be ignored");var e=document.getElementById("vite-legacy-polyfill"),n=document.createElement("script");n.src=e.src,n.onload=function(){System.import(document.getElementById('vite-legacy-entry').getAttribute('data-src'))},document.body.appendChild(n)}();</script>

Describe alternatives you've considered
Automatically add the ids that the plugin add for the scripts, or allow pass an id to the tag helpers, this will allow add the missing scripts manualy

<script nomodule id="vite-legacy-polyfill"
<script nomodule id="vite-legacy-entry"

Note: this ids are used in the scripts in the head, they are also needed for the first solution, but I think that only add the ids will be easer

@ElMassimo
Copy link
Owner

Hi Eduardo!

Pull requests are welcome!

@ElMassimo ElMassimo added the enhancement New feature or request label Sep 6, 2022
@alexookah
Copy link

Is this PR related?

@edumudu
Copy link
Author

edumudu commented Dec 15, 2023

I believe so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants