axios-debug-log icon indicating copy to clipboard operation
axios-debug-log copied to clipboard

[email protected] not compatible with unejected CRAv5

Open samselfridge-cnc opened this issue 2 years ago • 1 comments

To save anyone else the headache of figuring this out, Axios changed something with how they export the main module and its not compatible with the non-ejected CRA, and as CRA is deprecated at this point it likely never will be.

https://github.com/facebook/create-react-app/pull/12605 https://github.com/facebook/create-react-app/pull/12021

Problem is the var axios = require('axios') returns a string like /static/media/axios.5036f7f7333f291ef6b3.cjs not the actual package, so you get this error when trying to import axios-debug-log: Uncaught TypeError: Cannot read properties of undefined (reading 'request') at addLogger

Apparently you can run CRACO to get around this

I was able to get it running by copying over index.js and switching to an import statement

samselfridge-cnc avatar Oct 04 '23 23:10 samselfridge-cnc

Let me reopen this and restructure this package to a modern package with multiple types of export (cjs, esm etc).

Gerhut avatar Oct 07 '23 05:10 Gerhut