dcodeIO / bcrypt.js

Optimized bcrypt in plain JavaScript with zero dependencies.
Other
3.51k stars 267 forks source link

Cannot Import from `bcryptjs` in a Playwright Test #153

Closed ITenthusiasm closed 7 months ago

ITenthusiasm commented 7 months ago

Currently, I'm working on a project that's using Playwright for its end-to-end tests. We're using bcryptjs for hashing passwords in our application, but we aren't able to do this from within a Playwright test. This seems to be because bcryptjs doesn't support ESM. Is there any plan for ESM to be supported? Is there a timeline for this?

(For clarity on why we're using bcryptjs within Playwright: When we create an example user for a test, we have to hash the password because the application code is going to decrypt it.)

ITenthusiasm commented 7 months ago

So although this was a module issue, it was related to how I was importing from bcryptjs in my ESM application. Specifically, I couldn't do named imports. Doing a default import works fine. That said, it would still be great if this package supported ESM -- especially since things are going that way moving forward.

For historical purposes, I'm going to retitle this issue and close it so that people don't get confused and think that ESM Support was added (or rejected).