vite_ruby icon indicating copy to clipboard operation
vite_ruby copied to clipboard

Backport code from @vitejs/plugin-legacy to vite_plugin_legacy

Open Antti opened this issue 3 years ago • 1 comments

Description 📖

Backport most of the logic from @vitejs/plugin-legacy to vite_plugin_legacy

This is currently used in production for over a year to support a wide variety of legacy browsers.

Background 📜

@vitejs/plugin-legacy does a lot of magic to support legacy browsers by rewriting index.html, we're mostly interested in:

  • Safari 10 nomodule fix
  • A workaround for browsers that support modules, but do not support dynamic import:
    • script has type module, so only browsers which support modules would load it
    • if the dynamic import works - nothing happens
    • if the dynamic import fails - loads polyfills legacy
    • when polyfills legacy is loaded - it will then execute the entrypoint

Antti avatar Nov 03 '22 13:11 Antti

@ElMassimo Can we review and merge this?

alexookah avatar Dec 15 '23 09:12 alexookah