Closed nekopep closed 6 years ago
If you just include the library within a script tag, then it defines a dcodeIO
object globally, with a bcrypt
property.
Perfect!
I added:
<script src="./utils/bcrypt.min.js"></script>
in my main page
and then in my code:
import './bcrypt.min'
var bcrypt = dcodeIO.bcrypt;
The import was needed to tell webpack to include bcryptjs in the bundle.
Thanks! That reduced my bundle size a lot!
Hi, I am not getting bcryptjs to work in the browser. I am using next JS and typescript in a project. I tried to add a custom script tag and
import './bcrypt.min'
const bcrypt = dcodeIO.bcrypt;
but typescript does not like it at all! It does not find dcodeIO
variable, because it has to compile event before dcodeIO
can be initiated. So what should I do now?
Hello,
I've used bcryptjs in a simple react application. (in a web browser) To install it I used:
npm install bcryptjs
Then in my code I use:import bcrypt from 'bcrypt';
The issue is that it look like npm load a tons a sub libraries (elliptic.js 300KB etc...) because I can't manage to make the lib use the WebCrypto's Api.
As stated in the doc, it looks like I'm using it the bad way that is the node.js way. The issue is that I don't understand the current doc on how to use it correctly for browser purpose.
I tried to download the minified version and directly import it in my code, but then it syas dependencies are missing :/
Can you explain in the doc a little bit how to handle the browser case correctly? I'm a bit newbie on require / import subject :/
For example the:
var bcrypt = dcodeIO.bcrypt;
The doc is not clear for me, I don't know from where comes dcodeIO?
Thanks for any help!