Replies: 3 comments
-
Could you elaborate here? Afaik this script fixes a Safari bug where it'll load both |
Beta Was this translation helpful? Give feedback.
-
The first script is to account for Safari 10 which supports The polyfill detection is indeed a bit aggressive, I'm open to PRs to:
Re SystemJS - we are using the minimal |
Beta Was this translation helpful? Give feedback.
-
Right, but Vite could write a simple global variable (if it doesn't already, have to check again) and then thru The size savings also extends to the assets' internals too. With SystemJS, everything is wrapped and compiled different to accommodate the runtime. Eg, System.register(["./vendor-legacy.14fe4df4.js"],(function(){"use strict";var e,t,Q;return{setters:[function(r){e=r.a,t=r.y,Q=r.N}],execute:function(){...}
//vs
import{a as e,y as Q,N as t}from"./vendor.cc9d1722.js"; The runtime rewrites are fast/not noticeable. I'm sure that between Rich and I, we can find old benchmarks that support this. Was a while ago, and I misplaced/can't recall those numbers atm. |
Beta Was this translation helpful? Give feedback.
-
I'm glad the legacy plugin exists! I think it can be improved though.
Here's the bottom of the resulting
dist/index.html
that is produced:script[type=module]
is already/always attached, so there's no need for this "let's double-check" script.targets: ['defaults', 'not IE 11']
, there's a surprising amount of polyfills in there, most of which I think aren't actually needed.dimport
(mine) andshimport
, both of which are significantly smaller than the SystemJS runtime & would allow Vite to output ESM format. Both of these rewriteimport
,export
, andimport()
statements.For the last few years, my personal & client projects have been producing a single set of ESM + ES2015 assets, and are attached to two different sets of
<script>
tags -- has been working well. (Obviously multiple ES-targets
is preferred, it's just not something I/we needed, nor something I wanted to configure.)Related Demo App: /~https://github.com/lukeed/bug-vite-legacy-inline-css
Beta Was this translation helpful? Give feedback.
All reactions