christophgysin / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error bundling script using this package: `Uncaught SyntaxError: Identifier xxx has already been declared`

opened this issue · comments

Describe the bug

Hi, when using deno bundle on a script that uses this package I get a range of errors when running the bundled files.

Your environment

SDK version number

aws_sdk@v3.32.0-1/client-s3

Details of the deno version

deno 1.26.1 (release, aarch64-apple-darwin)
v8 10.7.193.3
typescript 4.8.3

Steps to reproduce

Save the following code to a file:

import { ListObjectsCommand, S3Client } from 'https://deno.land/x/aws_sdk@v3.32.0-1/client-s3/mod.ts';
const client = new S3Client({ region: Deno.env.get('AWS_REGION') || 'eu-west-1' });
const response = await client.send(new ListObjectsCommand({ Bucket: 'test', Prefix: '123', Delimiter: '/abc/' }));
console.log(response.Contents);

Run the following to create the bundle:

deno bundle file-you-just-made.ts mod.test.ts

Then try to use it:

 deno run -A mod.test.ts      

Observed behavior

Depending on the script being used I've seen a range of errors - for the simple script above I get:

error: Uncaught SyntaxError: Identifier 'toNumber' has already been declared
const toNumber = _strnum;

I have also seen:

error: Uncaught SyntaxError: Identifier 'ValidationError' has already been declared
class ValidationError extends CommandError {

Expected behavior

The bundled script should work

Additional context

I'm afraid this project is pretty much on hold until there is a workaround for #28.