diff --git a/.browserslistrc b/.browserslistrc index bdc7950d76..64fa758391 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -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 diff --git a/README.md b/README.md index 85345a485f..9f8e038f4a 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/package-lock.json b/package-lock.json index 6cd270d0bb..b0cb1b4a34 100644 --- a/package-lock.json +++ b/package-lock.json @@ -96,6 +96,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", @@ -11000,6 +11001,36 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/browserslist-to-esbuild": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/browserslist-to-esbuild/-/browserslist-to-esbuild-2.1.1.tgz", + "integrity": "sha512-KN+mty6C3e9AN8Z5dI1xeN15ExcRNeISoC3g7V0Kax/MMF9MSoYA2G7lkTTcVUFntiEjkpI0HNgqJC1NjdyNUw==", + "dev": true, + "dependencies": { + "meow": "^13.0.0" + }, + "bin": { + "browserslist-to-esbuild": "cli/index.js" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "browserslist": "*" + } + }, + "node_modules/browserslist-to-esbuild/node_modules/meow": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz", + "integrity": "sha512-pxQJQzB6djGPXh08dacEloMFopsOqGVRKFPYvPOt9XDZ1HasbgDZA74CJGreSU4G3Ak7EFJGoiH2auq+yXISgA==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/bser": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", @@ -38952,6 +38983,23 @@ "update-browserslist-db": "^1.0.9" } }, + "browserslist-to-esbuild": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/browserslist-to-esbuild/-/browserslist-to-esbuild-2.1.1.tgz", + "integrity": "sha512-KN+mty6C3e9AN8Z5dI1xeN15ExcRNeISoC3g7V0Kax/MMF9MSoYA2G7lkTTcVUFntiEjkpI0HNgqJC1NjdyNUw==", + "dev": true, + "requires": { + "meow": "^13.0.0" + }, + "dependencies": { + "meow": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz", + "integrity": "sha512-pxQJQzB6djGPXh08dacEloMFopsOqGVRKFPYvPOt9XDZ1HasbgDZA74CJGreSU4G3Ak7EFJGoiH2auq+yXISgA==", + "dev": true + } + } + }, "bser": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", diff --git a/package.json b/package.json index 39d3269515..2e32a7510f 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/code-studio/vite.config.ts b/packages/code-studio/vite.config.ts index ccf69151c4..1fe46d7529 100644 --- a/packages/code-studio/vite.config.ts +++ b/packages/code-studio/vite.config.ts @@ -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'; @@ -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 => { @@ -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, + }, + }, }; });