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
Hi, i've created a library and it was working fine, but after the update to 1.1.3 it started to give me a bunch of the following error :
"BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "stream": false }","
I'm currently using 1.1.2 and it's working fine, but since i'm not the only one that uses the library, i'm afraid of this issue, how can i fix this? i already tried to upgraded the version of both(library and project) to 1.1.3 and doesn't work, the only thing that worked for me until now was setting everything back to 1.1.2. Help!
Example Code
No response
Expected behavior
No response
Axios Version
1.1.3
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
No response
OS
No response
Additional Library Versions
angular 14.0.0
Additional context/Screenshots
No response
Reacted by Thomas Belin, rus_anonym, Constantin Graf, Luke Hatcher and Anush Hakobyan
It seems like the change of browser enrty with built cjs file affect more than expected?
When axios is used to create a library as above, the dist file can not be process with tool chain, while nodejs core modules (stream, https, etc) are not be polyfilled in dist cjs file...
I'd be concerned about needing to do a deep import of anything in a package.
@c4tc4tc4t Are you able to create a minimal Angular project that demonstrates the issue? It may be easier for other contributors to investigate based on this?
there u go @ajmas , make sure to install on a angular project to test, you can use the function checkImportStatus to test it, the error will occur when you run ng serve
I have never really worked with Angular, so I am not sure about the remaining recipe to be able to run this. I'd rather just focus at looking at the failure behaviour, since I don't have too much time on my hands.
ok, running some tests i found out that the problem is in the type AxiosResponseHeaders that comes from axios, did u guys change something with this type in this update?
i'll try to code a lib with the problem, now that i have a notion of what it is and a angularproject, so you guys can just clode the project and install the lib and have a better understading of what's going on, give me time to do it.
Ok, so what you have to do is create a Angular 14.0.0 project, then run "npm install https://github.com/c4tc4tc4t/poketeste" , i will install my typescript library that contains only one function, install axios in the Angular project and import the lib "import * as poke from 'axiosteste'", axiosteste is the name of my lib, try a console.log(poke.pokemon()); , if u run ng serve, you will get my error, waiting for some help on this, and of course if u change the version of axios on my lib and the project back to 1.1.2 everything works fine!
We have the same problem with our React app. We have been using axios since 0.19 and 1.1.3 breaks our webpack build. Reverting to 1.1.2 fixes the problem for
now but this needs to be fixed.
Given this issue isn't really fixed and instead only has a downgrade as workaround, we should probably keep this ticket open?
Reacted by Dmitriy Petrov, taipm-htv, Pavel Kuzmin, Adriano Ferrari, rus_anonym, Alexander Berezin, fro-dev-clau, r-raunr, Downey Robersscheuten, Constantin Graf and 4 more
I have the same problem when used in a library I am developing and after importing and using it in a CRA app. Its displays pollyfill errors (stream, https, zlib etc), I am using 1.3.5 v of axios. Is there any solution for this?
@ajmas Yes I added all the complaining polyfills, some errors were resolved but still there are more errors displaying as below. When I remove any use of axios in my library and imported the updated version to the sample app then the pollyfill errors are gone. Therefore I identified these polyfill errors come due to use of Axios (1.3.5)
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
- install 'stream-browserify'
The above same error is displaying for stream-http, https-browserify, fs, tty-browserify, os-browserify, browserify-zlib.
@mevannir Are you able to create a sample project that demonstrates this issue? It would make it easier to analyse what is going on and seeing if there is a workaround too.
Activity
ajmas commentedon Oct 19, 2022
You may want to look at you NodeJS version and what ES version you are targeting. It sounds like something is outdated in your tool chain?
AlbertAZ1992 commentedon Oct 19, 2022
It seems like the change of browser enrty with built cjs file affect more than expected?
When axios is used to create a library as above, the dist file can not be process with tool chain, while nodejs core modules (stream, https, etc) are not be polyfilled in dist cjs file...
v1.1.2...v1.1.3#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R9

jasonsaayman commentedon Oct 19, 2022
Ok, will have to have a look can i be given the environment details NPM/Node versions etc
c4tc4tc4t commentedon Oct 19, 2022
node v16.17.1 , it's a typescript library that i use in my angular projects, the version of Angular of my projects are all 14.0.0
povilass commentedon Oct 20, 2022
Browsers use modules/or will transpile module maybe just add it "import": "./dist/esm/axios.js",?
ajmas commentedon Oct 20, 2022
I'd be concerned about needing to do a deep import of anything in a package.
@c4tc4tc4t Are you able to create a minimal Angular project that demonstrates the issue? It may be easier for other contributors to investigate based on this?
ajmas commentedon Oct 20, 2022
I have never really worked with Angular, so I am not sure about the remaining recipe to be able to run this. I'd rather just focus at looking at the failure behaviour, since I don't have too much time on my hands.
c4tc4tc4t commentedon Oct 20, 2022
ok, running some tests i found out that the problem is in the type AxiosResponseHeaders that comes from axios, did u guys change something with this type in this update?
c4tc4tc4t commentedon Oct 21, 2022
still not figured out, acctually the lib that i created does not contain the error, my bad sry, but the actual lib i cant post it
c4tc4tc4t commentedon Oct 21, 2022
i'll try to code a lib with the problem, now that i have a notion of what it is and a angularproject, so you guys can just clode the project and install the lib and have a better understading of what's going on, give me time to do it.
c4tc4tc4t commentedon Oct 21, 2022
Ok, so what you have to do is create a Angular 14.0.0 project, then run "npm install https://github.com/c4tc4tc4t/poketeste" , i will install my typescript library that contains only one function, install axios in the Angular project and import the lib "import * as poke from 'axiosteste'", axiosteste is the name of my lib, try a console.log(poke.pokemon()); , if u run ng serve, you will get my error, waiting for some help on this, and of course if u change the version of axios on my lib and the project back to 1.1.2 everything works fine!
povilass commentedon Oct 23, 2022
Well this changed

Kinda destroyed what's use for browser and node platform because
axios\dist\node\axios.cjs
Got this

And axios\dist\axios.js got this

So this change must be reverted....
krzaczek commentedon Oct 23, 2022
We have the same problem with our React app. We have been using axios since 0.19 and 1.1.3 breaks our webpack build. Reverting to 1.1.2 fixes the problem for
now but this needs to be fixed.
fix: Revert axios to version 1.1.2
fix: Revert axios to version 1.1.2 (#4557)
1 remaining item
krutoo commentedon Oct 27, 2022
i have same issue, can someone tell how to fix that with 1.1.3 (without downgrade to 1.1.2)?
jlombardo-tableau commentedon Oct 27, 2022
yes, we need an actual fix for this, not to just revert to 1.1.2 in our code.
ajmas commentedon Oct 27, 2022
Given this issue isn't really fixed and instead only has a downgrade as workaround, we should probably keep this ticket open?
fix axios/axios#5154
Fix of [email protected] bug
KubaLorenc commentedon Jan 3, 2023
It works well with 1.2.0 version, but is broken again in 1.2.2
ajmas commentedon Jan 3, 2023
@KubaLorenc does it break in the same way as before the fix? If not, can you describe the failure mode?
mevan-aiken commentedon Apr 6, 2023
I have the same problem when used in a library I am developing and after importing and using it in a CRA app. Its displays pollyfill errors (stream, https, zlib etc), I am using 1.3.5 v of axios. Is there any solution for this?
ajmas commentedon Apr 6, 2023
Can you share the errors? Did you try adding the polyfill it is complaining about, as a package dependency?
mevan-aiken commentedon Apr 7, 2023
@ajmas Yes I added all the complaining polyfills, some errors were resolved but still there are more errors displaying as below. When I remove any use of axios in my library and imported the updated version to the sample app then the pollyfill errors are gone. Therefore I identified these polyfill errors come due to use of Axios (1.3.5)
The above same error is displaying for stream-http, https-browserify, fs, tty-browserify, os-browserify, browserify-zlib.
ajmas commentedon Apr 12, 2023
@mevannir Are you able to create a sample project that demonstrates this issue? It would make it easier to analyse what is going on and seeing if there is a workaround too.
fix: Revert axios to version 1.1.2 (#4557)