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 am currently converting some projects from hugo to astro.
In my build pipeline, I want to prepare the static websites also for some older browsers (Safari 10, for example, which does not support async functions).
Now I wanted to archive the same result with astro and the help of @vitejs/plugin-legacy. But unfortunately this way is not working.
@vitejs/plugin-legacy is already creating the correct files for this. But they are not inserted into generated HTML pages.
To be clear: I DO NOT want to use astro specific features (islands) on old browsers. I'm talking about a few scripts without big frameworks. For example to automatically convert the ?. operator and so on ...
I am aware that astro is not planning to support "the whole big thing" to be compatible with old browsers. Modern techniques require modern browsers. Sure. This has been stated at #6096 and I agree. As I said: I'm talking about beeing able to have a build pipeline outputting compatible versions of a few scripts for old browsers.
What's the expected result?
To have the correct @vitejs/plugin-legacy scripts inserted on build time.
The reason this isn't working automatically is because Astro does not currently support Vite's transformIndexHtml hook.
I'm not sure if there's a quick fix at the moment, but it could be something we can investigate. Unfortunately we can't expose the full html to the plugin, but we could (in theory) support the { tag, attrs, children }[] format.
Another note: transformIndexHtml can only work for prerendered pages. In SSR, you can't bundle the Vite plugins to execute its transformIndexHtml hooks. Which means there's a risk that the pages could be inconsistent depending on the configuration that I'm not sure if this is something we want to support.
Currently @vitejs/plugin-legacy doesn't support many metaframeworks because of this, but maybe there's a different way we can make legacy to work.
Closing as this is an issue regarding how @vitejs/plugin-legacy works, it's only intended to be used in Vite, non-metaframework projects. Since there's nothing we can do on our side, there's no reason to keep the issue open.
What version of
astro
are you using?2.8.3
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
pnpm
What operating system are you using?
Mac
What browser are you using?
Chrome (latest), Safari (latest)
Describe the Bug
I am currently converting some projects from hugo to astro.
In my build pipeline, I want to prepare the static websites also for some older browsers (Safari 10, for example, which does not support async functions).
Now I wanted to archive the same result with astro and the help of
@vitejs/plugin-legacy
. But unfortunately this way is not working.@vitejs/plugin-legacy
is already creating the correct files for this. But they are not inserted into generated HTML pages.To be clear: I DO NOT want to use astro specific features (islands) on old browsers. I'm talking about a few scripts without big frameworks. For example to automatically convert the
?.
operator and so on ...I am aware that astro is not planning to support "the whole big thing" to be compatible with old browsers. Modern techniques require modern browsers. Sure. This has been stated at #6096 and I agree. As I said: I'm talking about beeing able to have a build pipeline outputting compatible versions of a few scripts for old browsers.
What's the expected result?
To have the correct
@vitejs/plugin-legacy
scripts inserted on build time.Link to Minimal Reproducible Example
https://stackblitz.com/edit/withastro-astro-7equ4f?file=README.md
Participation
The text was updated successfully, but these errors were encountered: