ElMassimo / ElMassimo/vite_ruby

Add ids to the included legacy tags

Open
#252 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Ruby
Stars
1.6k
Forks
149
Avg merge
5h 13m
Merged PRs (30d)
2

Description

**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`
```html
try{import("_").catch(()=>1);}catch(e){}window.__vite_is_dynamic_import_support=true;
!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)}();
```

**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

```html
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.