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
We've been using it with an Amazon CDK project, and noticed that we get a bunch of warnings about the require.cache property from the following file (or at least, the compiled JS version):
> ../node_modules/@aws-cdk/aws-lambda/node_modules/@aws-cdk/core/lib/private/runtime-info.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning)
15 │ for (const fileName of Object.keys(require.cache)) {
╵ ~~~~~~~
> ../node_modules/@aws-cdk/aws-lambda/node_modules/@aws-cdk/core/lib/private/runtime-info.js: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning)
64 │ const mod = require.cache[fileName];
╵ ~~~~~~~
...
AIUI, these are explicitly not designed to be affecting bundling, are are just for introspecting the current set of packages. As such, they should be okay and not warned about, similar to require.main in #560.
(Fair warning: I don't understand all the moving parts here, so this could easily be a valid warning that needs to be fixed/addressed/managed upstream.)
The text was updated successfully, but these errors were encountered:
Thanks for pointing this out. This warning was intended to catch cases where people store require in a variable and then call it later, since esbuild doesn't track the identity of the function through indirect references. But any property access expression like this is probably fine to ignore and not warn about since it's probably just some other API that isn't going to end up calling require. So I'd like to fix this by just removing warnings for all property accesses off of require instead. I can make that change.
Hi, thanks for esbuild!
We've been using it with an Amazon CDK project, and noticed that we get a bunch of warnings about the
require.cache
property from the following file (or at least, the compiled JS version):https://github.com/aws/aws-cdk/blob/c0944d2fcd4351997b8b8e981f88cf3145e065b4/packages/%40aws-cdk/core/lib/private/runtime-info.ts
AIUI, these are explicitly not designed to be affecting bundling, are are just for introspecting the current set of packages. As such, they should be okay and not warned about, similar to
require.main
in #560.(Fair warning: I don't understand all the moving parts here, so this could easily be a valid warning that needs to be fixed/addressed/managed upstream.)
The text was updated successfully, but these errors were encountered: