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

Problems when building with vite #106

Open
sureshvv opened this issue Sep 5, 2022 · 5 comments
Open

Problems when building with vite #106

sureshvv opened this issue Sep 5, 2022 · 5 comments

Comments

@sureshvv
Copy link

sureshvv commented Sep 5, 2022

Could not load crypto (imported by node_modules/pouchdb-quick-search/lib/pouch-utils.js): ENOENT: no such file or directory, open 'crypto'
@sureshvv
Copy link
Author

sureshvv commented Sep 5, 2022

Create a new vite app and add the line import PouchDB from 'pouchdb-browser' to the file main.js

npm init vite-app testApp
cd testApp
npm i && npm i pouchdb-browser && npm i pouchdb-quick-search
npm run dev

@AlexErrant
Copy link

AlexErrant commented Sep 5, 2022

After a bit of work, I got this plugin working for my project. See the pouchdb-quick-search branch. I had to submodule https://github.com/arc-archive/pouchdb-quick-search after making a few changes (fixing the md5 error), buuuuut it works in vite. (I haven't merged it into main yet since I'm thinking about using a different library - but that would require a ton of work I'm not prepared to do.) Note that I also had to import it as a tgz - adding it as a directory reference failed for reasons I don't understand. I suck at Javascript.

@sureshvv
Copy link
Author

sureshvv commented Sep 5, 2022

Thanks @AlexErrant

I tried your changes. But it still fails in the same way.

Could not load crypto (imported by node_modules/pouchdb-quick-search/lib/pouch-utils.js): ENOENT: no such file or directory, open 'crypto'

I did a diff of pouch_utils in your branch vs the main branch and the only difference was the md5 library imported.

How did you deal with the crypto dependency?

@AlexErrant
Copy link

I commented it out:

image

I don't use it in node, so this was good enough for me.

@sureshvv
Copy link
Author

sureshvv commented Sep 6, 2022

I was looking at https://github.com/arc-archive/pouchdb-quick-search

Will check again. Thanks for the tip. I also need only browser functionality.

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

2 participants