axios-logger icon indicating copy to clipboard operation
axios-logger copied to clipboard

V2.8.0 Introduces incompatibilities with web and react native

Open gvanderclay opened this issue 10 months ago • 3 comments

Describe the bug When running the app in react-native, I get the following error

/Users/me/workspace/origamirisk/origami-flex/node_modules/axios-logger/lib/common/string-builder.js: path could not be
found within the project or in these directories:

I believe this is occurring because path is a node specific library, and it is being used in a non-node context. I haven't validated that this doesn't work in web, but I imagine it wouldn't since path is also not part of the standard library in web.

This appears to have been introduced in #149

To Reproduce Steps to reproduce the behavior:

  1. Add axios logger to a react native app
  2. Run the app and see above error

Expected behavior For it to work

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS

gvanderclay avatar Apr 02 '24 19:04 gvanderclay

Yep same issue for me with React Native / Expo:

The package at "node_modules/axios-logger/lib/common/string-builder.js" attempted to import the Node standard library module "path".
It failed because the native React runtime does not include the Node standard library.

Reverting to 2.7.1 solves it

vonkanehoffen avatar Apr 03 '24 11:04 vonkanehoffen

Yep same issue for me with React Native / Expo:

The package at "node_modules/axios-logger/lib/common/string-builder.js" attempted to import the Node standard library module "path".
It failed because the native React runtime does not include the Node standard library.

Reverting to 2.7.1 solves it

I'm still facing the same error even though reverting to 2.7.1 @vonkanehoffen.

bgarcia95 avatar Apr 07 '24 19:04 bgarcia95

How annoying @bgarcia95 ! FWIW even after getting it working I ended up reverting to just console.log middleware for my Expo project - kinda useful being able to drill into objects via the Chrome debugger.

vonkanehoffen avatar Apr 08 '24 14:04 vonkanehoffen

It seems like this code might be causing issues. Let's replace it with an alternative solution.

https://github.com/hg-pyun/axios-logger/pull/149/files#diff-24bd0dea6f9270ec272e72c2e2690eb208e7736288be32dbcfe3a74bc0a7877aR5

hg-pyun avatar May 29 '24 05:05 hg-pyun

@bgarcia95 @vonkanehoffen fixed on 2.8.1 version.

hg-pyun avatar May 29 '24 06:05 hg-pyun