Matthew C.
—When using the Amazon Web Services (AWS) Software Development Kit (SDK) for JavaScript or the AWS Amplify JavaScript library, you may get the following warning when building your application:
WARNING in ./node_modules/aws-crt/dist/native/binding.js 54:18-31 Critical dependency: the request of a dependency is an expression @ ./node_modules/aws-crt/dist/native/io.js 16:34-54 @ ./node_modules/aws-crt/dist/index.js 40:24-46
Because this is a JavaScript bundler warning triggered by dynamically imported dependencies in the AWS code, you can suppress it by modifying your bundler settings to ignore the following files:
node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/load-crt.js
node_modules/@aws-sdk/util-user-agent-node/dist-cjs/is-crt-available.js
For example, if your project used webpack:
You could add the above files as externals in your webpack.config.js
file to prevent them from being bundled. The files would then be retrieved at runtime.
You could also use the webpack exclude rule to exclude the AWS SDK from your bundle.
module.exports = { //... module: { rules: [ { test: /\.js$/, exclude: [ './node_modules/@aws-sdk/' ] } ] }, };
The request of a dependency is an expression
warning is a JavaScript bundler warning that indicates the presence of dynamically imported dependency. In this case, it is caused by an AWS SDK dependency that is also used by AWS libraries: the AWS Common Runtime (CRT) dependency, which is dynamically imported by a require
call by the @aws-sdk
package code.
Dynamic imports make JavaScript bundlers less effective at statically analyzing which modules to include in a build.
If a bundler can’t determine which modules to include in the final bundle, it is more likely to add unnecessary code to the bundle by including all the possible modules that an expression might resolve to.
An upcoming release of the AWS SDK for JavaScript will remove the dynamic require
call, which will fix this warning.
Tasty treats for web developers brought to you by Sentry. Get tips and tricks from Wes Bos and Scott Tolinski.
SEE EPISODESConsidered “not bad” by 4 million developers and more than 100,000 organizations worldwide, Sentry provides code-level observability to many of the world’s best-known companies like Disney, Peloton, Cloudflare, Eventbrite, Slack, Supercell, and Rockstar Games. Each month we process billions of exceptions from the most popular products on the internet.
Here’s a quick look at how Sentry handles your personal information (PII).
×We collect PII about people browsing our website, users of the Sentry service, prospective customers, and people who otherwise interact with us.
What if my PII is included in data sent to Sentry by a Sentry customer (e.g., someone using Sentry to monitor their app)? In this case you have to contact the Sentry customer (e.g., the maker of the app). We do not control the data that is sent to us through the Sentry service for the purposes of application monitoring.
Am I included?We may disclose your PII to the following type of recipients:
You may have the following rights related to your PII:
If you have any questions or concerns about your privacy at Sentry, please email us at compliance@sentry.io.
If you are a California resident, see our Supplemental notice.