-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: extend minimum browser support using APP_LEGACY_BUILD env-var
* feat(project): manage minimum browser support * fix: inject variables into index.html * chore: remove .js from import * chore: polyfills as first entry point * chore: restore index.html doctype * chore: conditional legacy browser support using custom vite plugin * chore: polyfills in ignoreDependencies instead of peerDependecies --------- Co-authored-by: Mike van Veenhuijzen <[email protected]>
- Loading branch information
Showing
10 changed files
with
45 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; // Fallback | ||
height: 100dvh; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { Plugin } from 'vite'; | ||
|
||
export const legacyBrowserPlugin = (enabled: boolean = true): Plugin => { | ||
return { | ||
name: 'legacy-browser', | ||
resolveId(id) { | ||
if (id.includes('virtual:polyfills')) { | ||
return '\0' + id; | ||
} | ||
}, | ||
load(id) { | ||
if (id.includes('\0virtual:polyfills')) { | ||
return enabled ? "import './src/polyfills';" : 'export default {};'; | ||
} | ||
}, | ||
config(config) { | ||
if (enabled) { | ||
config.build = config.build ?? {}; | ||
config.build.target = ['es2020', 'edge88', 'firefox78', 'chrome68', 'safari14']; | ||
} | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import 'core-js/es/array/flat-map'; | ||
import 'core-js/es/object/from-entries'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters