POC / Support old browsers by using @vitejs/plugin-legacy
#179
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change will make the site work on older browsers.
Build instructions:
cd platforms/web APP_DEFAULT_CONFIG_SOURCE=gnnuzabk LEGACY_DEBUG=true yarn build yarn vite preview --host
Now visit the URL in your old browser.
Unfortunately, you will need to rebuild the app on every change since it is not possible to inject polyfills/transforms on-the-fly on a dev server.
I ran into an issue where Chromium 68 should load the "legacy" version based on a browser feature detection algorithm within plugin-legacy (see source). But it didn't.
Therefore I introduced the
LEGACY_DEBUG
flag to enforce loading the polyfills. I can give a detailed explanation about this endeavor if needed (it goes in to the specifics of chromium) ;) This is what I finally ended up with. I think this makes development easier, as we can locally install Chromium instead of being dependent of an external browser.LEGACY_DEBUG
is a temporary solution that I do not want to commit into the code.I still need to find some kind of way to combine@vitejs/plugin-legacy
withvite-plugin-html
because currently I discarded the latter, because the first takes care of the logic of deciding in loading the modern vs. legacy bundle.Ticket: https://videodock.atlassian.net/browse/OTT-1130