evanw / evanw/esbuild

Strategy to determine visiting browser's inclusion or exclusion from the esbuild bundle target?

Open
#3,758 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
40.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

I would like to build my bundles given a specific set of browsers and if a visitor comes to the site that is not part of that set, they would get a "no JS" experience, with minimal/simplified JS. I am currently roughly doing this by setting my bundles with the `es6` target and then where scripts are loaded in the HTML, I'm checking if `window.fetch` is supported.

I would rather feed in a browserslist via https://github.com/marcofugaro/browserslist-to-esbuild or similar and then be able to reference a variable via `window` or similar that would tell me whether the visiting browser was included or excluded from esbuild target.

Any suggestions on the best practice way to accomplish the above?

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names esbuild target configuration, browserslist-to-esbuild, and the HTML script-loading check, but no source files or tests. First clarify whether the desired outcome is an esbuild feature or application-level guidance; done would require an agreed approach with documented behavior for browsers inside and outside the target.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.