Skip to content

Commit

Permalink
fix: Restrict officially supported browserlist (#2159)
Browse files Browse the repository at this point in the history
Closes #1752
  • Loading branch information
AkshatJawne authored Jul 30, 2024
1 parent 1d51585 commit 5b06ecc
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 6 deletions.
10 changes: 6 additions & 4 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Use the default value for browsers we support https://browsersl.ist/#q=defaults
# Used by post-css only, JS browser targeting is controlled by Vite https://vitejs.dev/config/build-options.html#build-target

defaults
last 0.5 years and Chrome > 0
last 0.5 years and Edge > 0
last 0.5 years and Opera > 0
last 0.5 years and Firefox > 0
last 1 years and Safari > 0
Firefox ESR and not dead
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,14 @@ npx source-map-explorer 'packages/code-studio/build/static/js/*.js'

## Browser Support

Support is best for [Google Chrome](https://www.google.com/intl/en_ca/chrome/) and Chromium based browsers (such as [Microsoft Edge based on Chromium](https://www.microsoft.com/en-us/edge)). We try and maintain compatibility with [Mozilla Firefox](https://www.mozilla.org/en-CA/firefox/new/) and [Apple Safari](https://www.apple.com/ca/safari/) as well.
Support is best for [Google Chrome](https://www.google.com/intl/en_ca/chrome/) and Chromium based browsers (such as [Microsoft Edge based on Chromium](https://www.microsoft.com/en-us/edge)). We also maintain compatibility with [Mozilla Firefox](https://www.mozilla.org/en-CA/firefox/new/) and [Apple Safari](https://www.apple.com/ca/safari/).

Officially, the following browsers and corresponding configurations are supported:

- Chrome: Versions from the last 0.5 years
- Edge: Versions from the last 0.5 years
- Opera: Versions from the last 0.5 years
- Firefox: Versions from the last 0.5 years, including Firefox ESR
- Safari: Versions from the last 1 year

If you encounter an issue specific to a browser, check that your browser is up to date, then check issues labeled with [firefox](https://github.com/deephaven/web-client-ui/labels/firefox) or [safari](https://github.com/deephaven/web-client-ui/labels/safari) for a list of known browser compatibility issues before reporting the issue.
48 changes: 48 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
"@types/shell-quote": "^1.7.1",
"@vitejs/plugin-react-swc": "^3.3.0",
"@vscode/codicons": "0.0.36",
"browserslist-to-esbuild": "^2.1.1",
"chokidar-cli": "^2.1.0",
"conventional-changelog-conventionalcommits": "^7.0.0",
"cross-env": "^7.0.2",
Expand Down
14 changes: 13 additions & 1 deletion packages/code-studio/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// This is a dev dependency for building, so importing dev deps is fine
/* eslint-disable import/no-extraneous-dependencies */
import { defineConfig, loadEnv } from 'vite';
import browserslistToEsbuild from 'browserslist-to-esbuild';
import react from '@vitejs/plugin-react-swc';
import path from 'path';

Expand Down Expand Up @@ -100,7 +101,9 @@ export default defineConfig(({ mode }) => {
outDir: path.resolve(__dirname, env.VITE_BUILD_PATH),
emptyOutDir: true,
sourcemap: true,
target: 'esnext',
build: {
target: browserslistToEsbuild(),
},
rollupOptions: {
output: {
manualChunks: id => {
Expand Down Expand Up @@ -143,5 +146,14 @@ export default defineConfig(({ mode }) => {
devSourcemap: true,
},
plugins: [react()],
esbuild: {
/**
* Prevents ESBuild to throw when using a feature not supported by the
* list of supported browsers coming from the `browserslist` file.
*/
supported: {
'top-level-await': true,
},
},
};
});

0 comments on commit 5b06ecc

Please sign in to comment.