DavidTanner / nodecredstash

MIT License
43 stars 22 forks source link

Cannot `require()` package #39

Closed IgnacioPinedo closed 1 year ago

IgnacioPinedo commented 1 year ago

I've used nodecredstash@2.0.2 for a while now, but wanted to upgrade to leverage the aws-sdk v3 separate modules and decreased node_modules folder size. Unfortunately the repo I use it in doesn't support ES6 and I can't require() the package. This is the error I'm seeing:

/.../node_modules/nodecredstash/src/index.js:13
import { KMSClient } from '@aws-sdk/client-kms';
^^^^^^

SyntaxError: Cannot use import statement outside a module

It would be nice if the package was imported using CommonJS instead of ES6, that way it could be used in both ES6 and non-ES6 repos.

To reproduce you only need to try and require() the package in any file. An easy way to do this, is by going to the npm package RunKit and clicking run.

IgnacioPinedo commented 1 year ago

All that would be needed is just update the tsconfig.json file to have the compilerOptions.module option set to CommonJS.

HenryLuoOne commented 1 year ago

I have same issue as well (version 2 is working, but not version 3), seeing same runtime error.

cherath commented 1 year ago

I have the same issue. I have to move to v3.0.0.0 and now getting the same error. How did you resolve it? The pull request has not been merged.

knowvishnu commented 1 year ago

Hi @IgnacioPinedo @HenryLuoOne @cherath, have you found any solution of this issue ?

IgnacioPinedo commented 1 year ago

Just as a note, we still have not resolved this. Currently I have all my functions using AWS v3 expect credstash which is still using v2 due to this issue.

IgnacioPinedo commented 1 year ago

Just waiting until it's released and I'll close the issue. The action to release is failing due to a token issue.

cherath commented 1 year ago

Hi All, Thanks for letting us know.

Kind Regards, Chulani


From: Ignacio Pinedo @.> Sent: Tuesday, 17 October 2023 8:02 AM To: DavidTanner/nodecredstash @.> Cc: cherath @.>; Mention @.> Subject: Re: [DavidTanner/nodecredstash] Cannot require() package (Issue #39)

Closed #39https://github.com/DavidTanner/nodecredstash/issues/39 as completed.

— Reply to this email directly, view it on GitHubhttps://github.com/DavidTanner/nodecredstash/issues/39#event-10670637225, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AETMWGK4SDSETZ3FN2A4JLTX7WOFPAVCNFSM6AAAAAAS64EGTGVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJQGY3TANRTG4ZDENI. You are receiving this because you were mentioned.

T