Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jy852095639 opened this issue May 21, 2024 · 8 comments
Closed

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

jy852095639 opened this issue May 21, 2024 · 8 comments
Assignees
Labels
closed-for-staleness documentation This is a problem with documentation. response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.

Comments

@jy852095639
Copy link

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

@jy852095639 jy852095639 added documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels May 21, 2024
@aBurmeseDev
Copy link
Member

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

@aBurmeseDev aBurmeseDev added response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels May 22, 2024
@jy852095639
Copy link
Author

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
})

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. label May 23, 2024
@Tookfreshman
Copy link

Tookfreshman commented May 24, 2024

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

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

@aBurmeseDev aBurmeseDev self-assigned this Jun 10, 2024
@aBurmeseDev
Copy link
Member

@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)?

@aBurmeseDev aBurmeseDev added the response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. label Jun 10, 2024
Copy link

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.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Jun 21, 2024
@rose-kv
Copy link

rose-kv commented Jul 22, 2024

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

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

I tried this, and the issue of "could not read properties of undefined (reading 'prototype')" is fixed.

Found this from the index.d.ts file,
Setting this option to true will wrap all CommonJS files in functions which are executed when they are required for the first time, preserving NodeJS semantics. Note that this can have an impact on the size and performance of the generated code.

Should this be a concern ?

@maxipk
Copy link

maxipk commented Aug 28, 2024

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

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

Works for me!
Thanks a lot, i was getting really mad!

@ngphuc2808
Copy link

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

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

Thank u bro!!! it's works for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-for-staleness documentation This is a problem with documentation. response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.
Projects
None yet
Development

No branches or pull requests

6 participants