antelle / argon2-browser

Argon2 library compiled for browser runtime
https://antelle.net/argon2-browser
MIT License
363 stars 78 forks source link

Import is an empty module in Vite #75

Closed billy4479 closed 2 years ago

billy4479 commented 2 years ago
import * as argon2 from 'argon2-browser'
console.log(argon2.hash) // undefined

I'm using Vite as bundler and Typescript

antelle commented 2 years ago

Sounds like bundler issues

ooesili commented 1 year ago

@billy4479 did you ever figure this out?

billy4479 commented 1 year ago

Not really, I ended up the Web Crypto API but there are many forks that work fine with Vite, just have a look on npm, they are not as popular as this package but they are there.

78 would probably fix this but it sill hasn't been merged at the time writing. I think the author has published an npm package with the changes though.

davidyuk commented 1 year ago

I think the author has published an npm package with the changes though.

it is published as @aeternity/argon2-browser

luojinzhang commented 4 months ago

I added this to vite.config.ts to make it work with vite


resolve: {
    alias: {
      'argon2-browser': path.resolve(
       'path/to/root',
        'node_modules/argon2-browser/dist/argon2-bundled.min.js'
      ),
    },
  }