You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use Svelte on a browser that only has ECMAScript 5.1 support.
The aim is to use the current Vite build system with minimal playing around.
I know that in the past, rollup was used directly which meant you could do a whole lot of playing around with configs and use a ECMAScript 5.1 conversion plugin.
Describe the proposed solution
Is there a flag I can use to change the output?
Importance
It would be great since I'm not a JS developer and playing with configs intimidates me.
The text was updated successfully, but these errors were encountered:
pjebs
changed the title
Build flat to select ECMAScript version for output
Build flag to select ECMAScript version for output
Jan 6, 2025
There used to be a legacy option for compilation, but that was removed with the release of Svelte 5. There are similar issues to this, but not exactly the same, you might want to look at #558 and #14420. From what I've found, most people recommend using Rollup (which you mentioned), SWC, or Babel. I've used both SWC and Rollup, and found them to be pretty easy to use.
If you were to use SWC, you could do it programmatically, like this:
And then you could transform an entire directory of files, like this:
build('src','es5');//if your files are in the `src` directory
Note: This script I have provided is rather minimal and doesn't account for things like error handling.
You could also use the (unofficial) Vite plugin and just transfer the config from the script above to the plugin's config.
ES5 does not have lots of features we rely on, so beyond downleveling syntax you would also need a bunch of polyfills. Most notably, Svelte 5 uses proxies, which AFAIK are not really polyfillable.
Converting this to a discussion because this is neither a feature request (or rather; we won't add such an option) nor a bug report.
Uh oh!
There was an error while loading. Please reload this page.
Describe the problem
I want to use Svelte on a browser that only has ECMAScript 5.1 support.
The aim is to use the current Vite build system with minimal playing around.
I know that in the past, rollup was used directly which meant you could do a whole lot of playing around with configs and use a ECMAScript 5.1 conversion plugin.
Describe the proposed solution
Is there a flag I can use to change the output?
Importance
It would be great since I'm not a JS developer and playing with configs intimidates me.
The text was updated successfully, but these errors were encountered: