Resulting file includes a "use strict"; in the first line from the esbuild bundler:
$ head dist/test.js
"use strict";
var __getOwnPropNames = Object.getOwnPropertyNames;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
// node_modules/aws-sdk/lib/json/builder.js
var require_builder = __commonJS({
"node_modules/aws-sdk/lib/json/builder.js"(exports, module2) {
var util = require_util();
That means all bundled files have strict mode enabled and not only the test.js file which declared it. It feels like this is a bug in esbuild but still we should solve it in the sdk as well.
If the file is executed in node strict mode https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode#assigning_to_undeclared_variables the line fails. Typically that should not happen because the file does not declare a "use strict" at the top but with some bundlers it can still happen.
Steps to reproduce:
package.json
test.js
Command to bundle:
Resulting file includes a
"use strict";
in the first line from the esbuild bundler:That means all bundled files have strict mode enabled and not only the test.js file which declared it. It feels like this is a bug in esbuild but still we should solve it in the sdk as well.
Fixes https://github.com/aws/aws-sdk-js/issues/4486
Checklist
npm run test
passes - not needed.d.ts
file is updated - not needednpm run add-change
- not needed?bundle exec rake docs:api
and inspectdoc/latest/index.html
if documentation is changed - not needednpm run integration
if integration test is changed - not needed