You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WMR does not handle the "browser" field of imported packages correctly #784
Packages making use of the browser field in their package.json to replace certain imports with others when running in a browser context throw an error.
This is not an issue if the package defines esmodules, modern, module, ..., but occurs in the case of the axios package for example because they define only the browser and main in their package.json.
The issue also doesn't occur if the browser field is simply a string.
To Reproduce
(Add the axios package) and import it in any file
Run npm start (or yarn run start if that's more your cup of tea)
Navigate to the page and see the error
Expected behavior
WMR bundles the package and handles the browser field correctly.
Bug occurs with:
wmr or wmr start (development)
wmr build (production)
wmr serve
Desktop (please complete the following information):
resolve.exports's legacy (imported as _resolveLegacyEntry in this file) can also return a Record<string, string | false> due to the browser field, which is not handled - the code tries to call replace on what is possibly an object, causing it to throw an error in cases like these.
Activity
[-]WMR does not handle the "browser" field of packages correctly[/-]