Skip to content

feat!(create): upgrade default browser targets #7147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/cli/uni-builder/src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export const getHash = (config: NormalizedEnvironmentConfig) => {
return filenameHash ? '.[contenthash:8]' : '';
};

// TODO(@vegerot): update this to `['defaults']` for next breaking change release
const DEFAULT_WEB_BROWSERSLIST = ['> 0.01%', 'not dead', 'not op_mini all'];

const DEFAULT_BROWSERSLIST: Record<RsbuildTarget, string[]> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,12 @@ See the [performance.bundleAnalyze](/configure/app/performance/bundle-analyze.ht

Modern.js will compile the code according to the project's Browserslist config, and inject some Polyfills. If the project does not need to be compatible with legacy browsers, you can adjust the Browserslist and drop some legacy browsers, thereby reducing the compilation overhead on syntax and polyfill.

Modern.js's default Browserslist config is:
Modern.js's projects are created with the [default](https://github.com/browserslist/browserslist/blob/7b0ff670e997c53b13d44e2150ab09807a20ed6b/index.js#L477) Browserslist config.

```js
['> 0.01%', 'not dead', 'not op_mini all'];
```

For example, if you only need to be compatible with browsers above Chrome 61, you can change it to:
For example, if you only need to be compatible with the latest Chrome versions, you can change it to:

```js
['Chrome >= 61'];
['last 2 chrome versions'];
```

:::tip
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
chrome >= 51
edge >= 15
firefox >= 54
safari >= 10
ios_saf >= 10
# > 0.5%, last 2 versions, Firefox ESR, not dead

defaults
1 change: 1 addition & 0 deletions packages/toolkit/utils/src/cli/get/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const getAntdMajorVersion = (appDirectory: string) => {
}
};

// TODO(@vegerot): update this to `['defaults']` for next breaking change release
export const defaults = ['> 0.01%', 'not dead', 'not op_mini all'];

export const getBrowserslist = (appDirectory: string) =>
Expand Down