-
Notifications
You must be signed in to change notification settings - Fork 29
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
Module not found: Error: Can't resolve 'stream/web' #117
Comments
don't get why u recive a error. it's wrapped around a try/catch |
@ctq123 I believe that this is only a warning right? When WebPack detects an import inside |
Running sapper, rollup, on AWS Lambda with version nodejs14.x. I'm getting the error:
Rollup treats 'stream/web' as an external & hoists the require to the top of the js payload file. The output looks something like this: import require$$0 from 'stream/web';
// ...
if (!globalThis.ReadableStream) {
try {
Object.assign(globalThis, require$$0);
} catch (error) {
// TODO: Remove when only supporting node >= 16.5.0
Object.assign(globalThis, ponyfill_es2018.exports);
}
} |
Hmm, i did not account for bundlers to hoist stuff like this. This kind of conditional import should really be converted to top level await + async import to match the same behavior... |
webpack should add |
yes,it don't affect packaging, but it's not friendly to runtime |
this issue prevents sveltekit from updating to node-fetch 3.0.0 I've tried looking into it yesterday and wonder about a couple of things:
|
dynamic import is challenging i have tried to best come up with a solution that don't import/depend on core node stuff. so that require can gracefully fail in Deno and Browser |
Here's the problematic line for reference: Line 7 in 46476fa
|
Would anyone be able to report this as a bug to Rollup that it's hoisting the import outside of the try / catch? I tried taking a look at it briefly, but wasn't able to reproduce in the REPL. I'm wondering if anyone has ideas for reproducing this for a bug report? |
Kind of already did: rollup/rollup#3621 |
It could also be someones else fault... I mean the file is in a |
This looks like it could be related: https://github.com/rollup/plugins/tree/master/packages/commonjs#ignoretrycatch. Vite includes |
Actually, that option did fix the error for me. I just set it in the wrong place the first time around. Here's a working version: sveltejs/kit#2422 I think the default value for this option should be changed in |
Thank you @benmccann for finding the root cause and reporting issues |
|
Vite 2.6.3 and SvelteKit 1.0.0-next.180 have been released and use the fixed version of |
good to hear, dose it work okey now to include fetch-blob? |
Yes |
Reproduction
Module not found: Error: Can't resolve 'stream/web' in '/Users/alan/project/duapp/vscode/packages/du-i18n/node_modules/fetch-blob'
Steps to reproduce the behavior:
Expected behavior
start success
Screenshots
Your Environment
vscode extension development
Additional context
The text was updated successfully, but these errors were encountered: