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

Userbase doesn't work with Vite / Rollup #203

Open
braebo opened this issue Sep 2, 2020 · 5 comments
Open

Userbase doesn't work with Vite / Rollup #203

braebo opened this issue Sep 2, 2020 · 5 comments

Comments

@braebo
Copy link

braebo commented Sep 2, 2020

When trying to start a fresh App with userbase-js as a dependency, I get the following error from Vite:
Screenshot 2020-09-01 at 6 17 29 PM

When starting my app with userbase-js as a dev dependency:
import userbase from 'userbase-js'; or import * as userbase from 'userbase-js';
Error Screenshot

import userbase from '../../node_modules/userbase-js/dist/userbase.js';
Error Screenshot 2

import * as userbase from '../../node_modules/userbase-js/dist/userbase.js';
Error screenshot 3

I found a reference in Vite issue #728, but none of the fixes there seemed to help.

I've been stuck on this for days now, and I don't seem to be getting any closer to figuring it out. Any advice would be greatly appreciated!

@braebo
Copy link
Author

braebo commented Sep 2, 2020

The main error seems to be:
Screenshot 2020-09-02 at 9 48 03 AM

I wonder if nodejs/node#32137 could have anything to do with this?

@braebo
Copy link
Author

braebo commented Sep 2, 2020

To reproduce:

yarn create vite-app test
cd test
yarn add userbase-js -D

Then, in App.vue, adding import userbase from 'userbase-js' anywhere in the <script> tag results in the above errors.

I can bypass them by including them in vite.config.js:

module.exports = {
    optimizeDeps: {
        include: ['base64-arraybuffer', 'diffie-hellman']
    }
}

But that results in another error:

[vite] Dep optimization failed with error:
Dependency safe-buffer is attempting to import Node built-in module buffer.
This will not work in a browser environment.

I seem to be getting warmer.

@snehalbaghel
Copy link

@fractalhq were you able to get it running?

@braebo
Copy link
Author

braebo commented May 17, 2021

I wasn't unfortunetaly. It's been awhile since I tried- I have a Svelte app using Vite in the works that I was considering userbase for, so I'll let you know how that goes. I have some ideas on how to get it working if it's still a problem.

@Crenshinibon
Copy link

Same issue here. Any news?

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

3 participants