Skip to content

[plugin-legacy] The default value of the modernTargets does not support all target browsers #16360

@Fitz6

Description

@Fitz6

Describe the bug

The default value of modernTargets is edge >= 80, firefox >= 72, chrome >= 80, safari >= 13.1, chromeAndroid >= 80, iOS >= 13.1.

For example, if my .browserslistrc is chrome > 63, then I used Promise.allSettled (available in Chrome >= 76).
Following the build process, if you attempt to open it in Chrome versions 64 to 79, you will encounter the error Uncaught TypeError: Promise.allSettled is not a function, as polyfills are not generated for these versions.

You must manually set modernTargets to chrome > 63 for it to work properly. It's confusing.

Reproduction

https://stackblitz.com/edit/vitejs-vite-67qumq

Steps to reproduce

No response

System Info

Browsers:
    Chrome: 74.0.3729.131
  npmPackages:
    @vitejs/plugin-legacy: ^5.3.2 => 5.3.2
    vite: ^5.2.7 => 5.2.7

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)plugin: legacy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions