Closed ciscoheat closed 1 year ago
Hi @ciscoheat ,
Thanks for opening this issue.
Since you are using a 3rd party tool, and we don't have repro steps this will make it hard to root cause.
suddenly get an ESM-related error when using vitest with a SvelteKit site. By configuring vite to inline the packages, it works again.
This being a sudden change is worrisome, this might be a breaking change from the SDK side. Can you help us somehow reproduce this error? Perhaps a minimal setup, or an explanation of how you are using the SDK in this case? Are you importing that @aws-sdk/signature-v4-multi-region directly?
Thank you, Ran
Hello Ran, it is difficult to reproduce. By just adding the @aws-sdk library to an empty project gives no problem. And the build works without error with SvelteKit, but when testing it with Vitest, the error occurs, even though they are using the same configuration (both are built on Vite).
I'm not importing any of the mentioned libraries, this is my only reference, in a single file:
import { S3Client, PutObjectCommand, DeleteObjectCommand } from '@aws-sdk/client-s3';
And to make things more confusing, there is no reference to this file in the tests.
I am getting the same error on @aws-sdk/client-s3 v3.267.0
If you would like to investigate the commit is here. It only popped up when I imported from @aws-sdk/client-s3 in the file under test.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.
Checkboxes for prior research
Describe the bug
In version 3.257.0 I suddenly get an ESM-related error when using vitest with a SvelteKit site. By configuring vite to inline the packages, it works again.
SDK version number
@aws-sdk/util-user-agent-node@3.257.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v18.10.0
Reproduction Steps
Sorry but I cannot reproduce this in an easy way. I'm hoping that the error is well-known and has an easy fix.
Observed Behavior
Expected Behavior
No error message, it used to work fine.
Possible Solution
No response
Additional Information/Context
The suggested workaround works, when adding this to
vite.config.js