axios: axios 1.1.3 can't use in a library
Describe the issue
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
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 6
- Comments: 23 (1 by maintainers)
Links to this issue
Commits related to this issue
- fix: Revert axios to version 1.1.2 Axios 1.1.3 has a problem with webpack build (see https://github.com/axios/axios/issues/5154) — committed to wireapp/wire-web-packages by atomrc 2 years ago
- fix: Revert axios to version 1.1.2 (#4557) Axios 1.1.3 has a problem with webpack build (see https://github.com/axios/axios/issues/5154) — committed to wireapp/wire-web-packages by atomrc 2 years ago
- fix https://github.com/axios/axios/issues/5154 — committed to MPT-Assistant/api-wrapper by deleted user 2 years ago
- Fix of axios@1.1.3 bug - details: https://github.com/axios/axios/issues/5154 - prettier line width 80 >> 100 — committed to krutoo/middleware-axios by krutoo 2 years ago
Given this issue isn’t really fixed and instead only has a downgrade as workaround, we should probably keep this ticket open?
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…
https://github.com/axios/axios/compare/v1.1.2...v1.1.3#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R9
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…