Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import is an empty module in Vite #75

Closed
billy4479 opened this issue Nov 10, 2021 · 5 comments
Closed

Import is an empty module in Vite #75

billy4479 opened this issue Nov 10, 2021 · 5 comments

Comments

@billy4479
Copy link

billy4479 commented Nov 10, 2021

import * as argon2 from 'argon2-browser'
console.log(argon2.hash) // undefined

I'm using Vite as bundler and Typescript

@billy4479 billy4479 changed the title Import is an empty module Import is an empty module in Vite Nov 10, 2021
@antelle
Copy link
Owner

antelle commented Nov 10, 2021

Sounds like bundler issues

@antelle antelle closed this as completed Nov 10, 2021
@ooesili
Copy link

ooesili commented Sep 26, 2022

@billy4479 did you ever figure this out?

@billy4479
Copy link
Author

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
Copy link

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

it is published as @aeternity/argon2-browser

@luojinzhang
Copy link

luojinzhang commented Feb 19, 2024

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'
      ),
    },
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants