-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read property 'call' of undefined #11
Comments
Line 7 is Can you check that |
It does not. In fact stream is an empty object. I get the feeling that the error is not related to this module. Sorry! |
@johannesjo Did you find the appropriate solution for above issue , because I facing the same issue
|
@gowtham-kumarappan sorry, I don't really remember :/ |
Did you find any solution to this problem? |
@xcsob now I remember even less. Sorry :) |
So anybody has any solution to this? Thanks |
@yabuking84 and other devs having the same issue: this is because Stream is undefined on client-side (browser) since it only belongs to Node. You are going to need to add a polyfill for Stream: if you are using sveltekit (like me), you can do this in your import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill'
import rollupNodePolyFill from 'rollup-plugin-node-polyfills'
<other configs>
resolve: {
alias: {
util: 'rollup-plugin-node-polyfills/polyfills/util',
sys: 'util',
events: 'rollup-plugin-node-polyfills/polyfills/events',
stream: 'rollup-plugin-node-polyfills/polyfills/stream',
path: 'rollup-plugin-node-polyfills/polyfills/path',
querystring: 'rollup-plugin-node-polyfills/polyfills/qs',
punycode: 'rollup-plugin-node-polyfills/polyfills/punycode',
url: 'rollup-plugin-node-polyfills/polyfills/url',
http: 'rollup-plugin-node-polyfills/polyfills/http',
https: 'rollup-plugin-node-polyfills/polyfills/http',
os: 'rollup-plugin-node-polyfills/polyfills/os',
assert: 'rollup-plugin-node-polyfills/polyfills/assert',
constants: 'rollup-plugin-node-polyfills/polyfills/constants',
_stream_duplex:
'rollup-plugin-node-polyfills/polyfills/readable-stream/duplex',
_stream_passthrough:
'rollup-plugin-node-polyfills/polyfills/readable-stream/passthrough',
_stream_readable:
'rollup-plugin-node-polyfills/polyfills/readable-stream/readable',
_stream_writable:
'rollup-plugin-node-polyfills/polyfills/readable-stream/writable',
_stream_transform:
'rollup-plugin-node-polyfills/polyfills/readable-stream/transform',
timers: 'rollup-plugin-node-polyfills/polyfills/timers',
console: 'rollup-plugin-node-polyfills/polyfills/console',
vm: 'rollup-plugin-node-polyfills/polyfills/vm',
zlib: 'rollup-plugin-node-polyfills/polyfills/zlib',
tty: 'rollup-plugin-node-polyfills/polyfills/tty',
domain: 'rollup-plugin-node-polyfills/polyfills/domain'
}
},
optimizeDeps: {
esbuildOptions: {
define: {
global: 'globalThis'
},
plugins: [
NodeGlobalsPolyfillPlugin({
process: true,
buffer: true
}),
NodeModulesPolyfillPlugin()
]
}
},
build: {
rollupOptions: {
plugins: [
rollupNodePolyFill()
]
}
} |
Solved this just by adding this: export default defineConfig({
// ......
resolve: {
alias: {
stream: 'stream-browserify'
}
},
} Should definitely be a part of the documentation. |
Adding alias to my vue.config.js file fixed the problem after spending long time. |
Running into this issue in angular, the following saved me:
Found here, with more advice to potentially problematic packages: https://stackoverflow.com/questions/67572355/webpack-5-angular-polyfill-for-node-js-crypto-js |
Stumbled across the same exception as the original poster of this issue, as part of a process to upgrade a project from Webpack Applied a similar solution as mentioned in the other comments of this issue. But what is slightly different with my solution, is that I applied resolve.fallback, which "Redirect module requests when normal resolving fails.", instead of resolve.alias. That way, it would attempt to resolve Node cores' own bundled Important You would also need to install the dependency module For example, The Webpack 5 configuration change solution in my case, provided below: 👇 {
// ....
"resolve": {
// ....
"fallback": {
// ....
"stream": require.resolve('stream-browserify')
}
}
} |
I encountered a similar issue and managed to resolve it successfully. Here's the solution I implemented:
This modification should address the issue and ensure compatibility with the stream-browserify package. Best regards, |
This worked perfectly for my VITE config :) Legend!!! 🤝 |
When using buffer (https://github.com/feross/buffer) I get the following error:
The text was updated successfully, but these errors were encountered: