aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.44k stars 2.13k forks source link

fix(storage): browser module resoltuion is not picked up by metro web #13881

Closed HuiSF closed 1 month ago

HuiSF commented 1 month ago

Description of changes

Issue #, if available

https://github.com/aws-amplify/amplify-js/issues/13853

Description of how you validated changes

When using the library with Expo, and run npx expo start, observed that the Storage uses fetch instead of xhr for making network requests. This caused that the Storage.get() returns a non Blob, response.Body.

The metro bundler respect the browser module in package.json, but observed it didn't pick up the resolution during testing. The cause is that the module entry doesn't contain an extension name.

Checklist

Checklist for repo maintainers

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.