Custom browserslist configuration for DNB services and web applications.
Install:
pnpm add -D @dnb/browserslist-config
yarn add -D @dnb/browserslist-config
npm install -D @dnb/browserslist-configIn your package.json file:
{
"browserslist": ["extends @dnb/browserslist-config"]
}You can display a list (table) readable for humans:
import supportedBrowsers from '@dnb/browserslist-config/supportedBrowsers.mjs'
// Will output an array with an object for each browser, containing "name" and "minimumVersion".Tools like Vite and esbuild do not read browserslist configuration. This package provides pre-built target strings compatible with these tools:
import buildTargets from '@dnb/browserslist-config/buildTargets.mjs'
// Returns e.g. ['chrome106', 'edge109', 'firefox115', 'ios13.1', 'safari13.1']Use with Vite:
import buildTargets from '@dnb/browserslist-config/buildTargets.mjs'
export default defineConfig({
build: {
target: buildTargets,
},
})Use with esbuild:
import buildTargets from '@dnb/browserslist-config/buildTargets.mjs'
await esbuild.build({
target: buildTargets,
// ...
})Note: Samsung Browser is excluded from build targets as it has no esbuild equivalent. Families that share an engine are merged — e.g. Chrome and Chrome Android produce a single
chrometarget using the lower version.
We use Conventional Commits to generate our changelogs. Please use the following format for your commit messages:
feat: add new feature
fix: fix bug
docs: update documentation
refactor: refactor code
perf: improve performance
test: add or update tests
ci: update ci configuration
chore: something elseWhen you merge a pull request, choose to squash the commits into one commit.
When a pull request is merged, a new release will be created automatically. The release will be tagged with the version number from the commit message.
Stay Updated: Regularly update your caniuse-lite database to ensure Browserslist has the most recent data. You can do this by running:
yarn dlx update-browserslist-db@latestUse the Browserslist CLI for Quick Checks: You can quickly see which browsers are selected by your current configuration by running:
yarn browserslist