web-infra-dev / rsbuild

The Rspack-based build tool. It's fast, out-of-the-box and extensible.
https://rsbuild.dev/
MIT License
1.77k stars 139 forks source link

[Bug]: async/await syntax present in build output despite setting externalsType: 'script' #3901

Open lichenabson opened 9 hours ago

lichenabson commented 9 hours ago

Version

System: macos Browser: Chrome126 npmPackages: @rsbuild/core@1.0.18

Details

I've noticed that when using externalsType: 'script' for asynchronously loading CDN files, the final build output always includes async/await syntax for the asynchronous CDN loading, regardless of the browser range specified in .browserslistrc. This causes compatibility issues in older browsers.

Specifically:

Setting externalsType: 'script' is intended to load CDN files asynchronously. The .browserslistrc file is configured to target specific browser versions. However, the build output consistently uses async/await syntax for CDN loading, ignoring the .browserslistrc settings. This results in compatibility problems with older browsers that don't support async/await.

Reproduce link

https://www.marscode.cn/ide/7oqyxje9lq9nee

Reproduce Steps

Image

  1. edit .browserslistrc
  2. run build
  3. Observe the output after processing the resources
9aoy commented 8 hours ago

No permission Image