-
Notifications
You must be signed in to change notification settings - Fork 287
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
Conditional require doesn't include bufferutil
#411
Comments
@blakeembrey thanks for the clear report on this. I think we should look into ensuring we have the strict behaviour both for correctness and debugging, so I would tend to agree this is a bug. Which version of ncc were you using here? Have you tried with the latest beta release? As I believe the behaviours would be different between the two. |
"performance penalty" applies only to older v8 versions. If you are using the latest node.js you should be fine. |
Does This issue sounds identical to #413 |
Definitely an identical issue! I had it from ws + AWS was the second one using buffer util, I think it would have de-duped if they both used as but can check when I’m home. |
@styfle Actually, this was a misdiagnosis. It was from |
@sokra Since it's AWS Lambda, it'd be node 10 as the latest. |
require
errorsbufferutil
Ran into this as well. I could work around it by making @styfle Trying to read between the lines here, but is there anything blocking the usage of |
I read this thread again and I'm not sure how to reproduce the issue. |
@styfle sure, a reproduction is pretty straightforward: // ./mod.js
throw new Error('kaboom')
// ./index.js
function tryRequire () {
try {
require('./mod.js')
console.log('bad!')
} catch (err) {
console.log('good!')
}
}
tryRequire()
tryRequire() When you run with
When you run/build with
The solution should be to add |
@Janpot Perfect! Let's enable |
* enable strictModuleExceptionHandling Fixes #411 * coverage
* enable strictModuleExceptionHandling Fixes vercel/ncc#411 * coverage
Not particularly an issue with either
ncc
orwebpack
but spent way too long debugging after I addedapollo
to my bundle. The issue is that both Apollo and Puppeteer have optional dependencies onbufferutil
, however only the firstrequire
throws and the second one just returns an empty object. This results in the runtime usage ofbufferutil
breaking for the second module, since both these are wrapped in atry..catch
already (as they're optional dependencies). This is a feature in Webpack and would need to be changed withstrictModuleExceptionHandling
but would incur a performance penalty.Wanted to open this for discussion on how this might be been easier debugged or how it should be handled properly. I'm not familiar with Webpack internals either to understand why this couldn't be turned on in a performant way (e.g. by late assigning to the internal module cache, or is this to support circular requires?).
The text was updated successfully, but these errors were encountered: