aws / aws-sdk-js

AWS SDK for JavaScript in the browser and Node.js
https://aws.amazon.com/developer/language/javascript/
Apache License 2.0
7.57k stars 1.55k forks source link

my aws-sdk project dont work in VUE3+Vite #4638

Closed jy852095639 closed 3 days ago

jy852095639 commented 1 month ago

Describe the issue

企业微信截图_17162877777521 node -v 17.0.0

vite 5.0.11

aws-sdk 2.1619.0

code: import AWS from 'aws-sdk' console.log(AWS) When I introduce and use AWS, I will report an error

Links

NO

aBurmeseDev commented 1 month ago

Hi @jy852095639 - thanks for reaching out.

Can you share your SDK code example that would give us more insight into the issue you're facing? Also it seems like you're using JavaScript SDK v2. If confirmed, I'll transfer this to our v2 repo.

Best, John

jy852095639 commented 1 month ago

import AWS from 'aws-sdk' AWS.config.update({ accessKeyId: myAccessKeyId, secretAccessKey: mySecretAccessKey, region: myRegion }) const s3 = new AWS.S3() return s3.getSignedUrl('getObject', { Bucket: bucket, Key: url })

Tookfreshman commented 1 month ago

@jy852095639 in vite.config.ts, add this config maybe solve this problem

export default defineConfig({ build: { commonjsOptions: { strictRequires: true, } } })

aBurmeseDev commented 2 weeks ago

@jy852095639 - appreciate for sharing the code. I don't see anything abnormal with the code.

Can you try updating Vite.config mentioned by @Tookfreshman (thanks for chiming in)?

github-actions[bot] commented 1 week ago

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.