How does a browser-target query or a Baseline target decide what a web build lowers and polyfills, and what changes when you move it?
answer
- one list, several consumers
- a floor, not a gate
- older floor, bigger output
- usage data drifts between builds
- a dated Baseline gives a fixed list
basics
~20 sThe target resolves to minimum browser versions; the transpiler lowers only syntax some listed browser lacks and the polyfill step adds only missing built-ins. An older floor means more rewritten code, more polyfills and larger bundles.
solid answer
~50 sA browser target is resolved at build time to a list of minimum versions: either versions you list explicitly, a usage-share or relative rule such as "the last two versions of each browser", or a Baseline target. Every transform step reads that same list: the transpiler lowers a feature only if some listed browser lacks it, the polyfill step adds only built-ins some listed browser is missing, and the CSS step often uses it too. Moving the floor older adds rewrites, helpers and polyfills, so bundles grow and run slower everywhere; moving it newer shrinks them, while browsers below the floor still load the files and break. Relative and usage-share rules are re-resolved against whatever browser data the build has, so the same rule can select different versions later; Baseline Widely available counts back from the evaluation date unless you pin it, and Baseline for a given year is a fixed list.
go deeper
Know that one list of target browsers decides what gets rewritten and what gets polyfilled, and that an older target means bigger output.
Explain how each step reads the resolved list, the difference between explicit, relative, usage-share and Baseline targets, and why a relative rule drifts between builds.
Show you would pin the target for reproducible builds, keep every step on one list, check whether dependencies are transformed, and measure the size cost of each browser you keep.
Treat the target as a support contract: who decides the floor, how it is reviewed against real traffic, and how a change is announced before it breaks a customer's fleet.
## What a browser target is A **browser target** is the build's answer to one question: what is the oldest engine this code must run on? However it is written, the build resolves it into a concrete list of minimum versions, such as one version floor per browser. That resolved list, not the way you wrote it, is what the transform steps read. The target is a **floor**. It tells the build which syntax and built-ins it may leave alone; it does not stop an older browser from downloading the files. ## One list, several consumers In a well-configured build, several steps read the same resolved list: - **The transpiler** lowers a syntax feature only when at least one target browser lacks it. With a recent floor, optional chaining and class fields pass through untouched; with an old one, they are rewritten. - **The polyfill step** injects a built-in such as `Array.prototype.at` only when at least one target browser lacks it. - **The CSS step** often uses the same list to decide prefixes and fallbacks (CSS transforms are a separate subject; the point here is the shared input). - **The minifier** may print shorter, newer syntax only when the target allows it, so an older floor can also make minified output less compact. Keeping one shared target matters: when the transpiler and the polyfill step read different lists, you can get bundles whose syntax runs on a browser that is then missing a built-in, or the reverse. ## Kinds of target | Kind of target | What it means | Same browsers in a later build? | |---|---|---| | Explicit versions | a floor you name per browser | yes, until you edit it | | Relative rule | for example the last two versions of each browser | no, it moves with each release in the build's data | | Usage-share rule | browsers above some share of traffic | no, it changes whenever usage data is updated | | Baseline Widely available | versions supporting every feature interoperable for at least 30 months | no, it moves forward with the evaluation date | | Baseline Widely available on a date | the same set, evaluated on a date you fix | yes | | Baseline for a year | versions supporting everything that was Newly available at the end of that year | yes | **Baseline** comes from the web-platform feature data: a feature becomes *Newly available* when every browser in the core set supports it, and *Widely available* 30 months after that keystone date. A dated or year-based Baseline target is therefore a fixed list of browsers, which is why it is recommended when builds must be reproducible. A relative or usage-share rule is convenient but drifts: a build of the same commit a few months later can lower less, polyfill less and quietly drop a browser you thought you supported. ## Moving the floor Moving the target changes the output in predictable ways: 1. **Older floor**: more syntax is rewritten, rewritten code is longer, helpers and generator runtimes appear, more polyfills are injected. Bundles grow and execute more slowly on every device, including current phones. 2. **Newer floor**: modern syntax ships as written and fewer polyfills are needed. Bundles shrink, and browsers below the new floor start failing with `SyntaxError` or missing built-ins. 3. **Unchanged rule, updated data**: with a relative or usage-share rule, refreshing the browser data alone can move the floor, so output changes without any change to your configuration. ## A target is a floor, not a gate Nothing in the output checks the visitor's browser. An engine below the floor still downloads the same files and then breaks. If you need older browsers to see an upgrade message or a different build, you have to add that yourself, for example with a separate legacy build or a feature check. Two more traps sit at the edge of the target: - **Dependencies** may not go through the same lowering. Whether a build transforms third-party code is a per-build choice, and a package published as modern syntax breaks an old browser if the build passes it through untouched. - **The target covers language features and built-ins the build knows about.** Web platform APIs outside the polyfill set, and features no build can emulate, still need checking by hand. ## Choosing a target for a real fleet For the ticket-hall kiosks in a transit app, start from facts rather than defaults: which exact browser version the kiosks run, and what share of traffic they carry. Then: - name that floor explicitly or choose a dated Baseline that includes it; - keep the transpiler, the polyfill step and the CSS step on the same list; - compare bundle sizes before and after the change, so the cost of each older browser is visible; - write down the date or version the target was set against, so a later build cannot drift silently.
- Why might two builds of the same commit, months apart, produce different output?Because a relative or usage-share rule is resolved against browser data bundled with the build tooling. When that data is updated, "the last two versions" or "browsers above some share" names different versions, so a different set of features is lowered or polyfilled. Listing explicit versions, or pinning a Baseline target to a date or a year, keeps the resolved list fixed and the build reproducible.
- Does raising the target stop users on older browsers from loading the site?No. The target only tells the build what syntax and built-ins it may leave alone. Nothing in the output checks the visitor's browser, so an older one still downloads the files and then fails with a SyntaxError or a missing built-in. Blocking older browsers, showing them a message or serving them another build is a separate decision you have to implement.
- The browser target blocks browsers below it from loading the site.
- Setting an older target makes the bundle smaller and faster.
- A rule like the last two versions always selects the same browsers.
- Baseline Widely available means only the newest browser releases.
- The polyfill step does not care which browsers the build targets.