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

Can I use without cordova? #83

Closed
Naki21 opened this issue Apr 7, 2017 · 5 comments
Closed

Can I use without cordova? #83

Naki21 opened this issue Apr 7, 2017 · 5 comments
Assignees

Comments

@Naki21
Copy link

Naki21 commented Apr 7, 2017

I am developing a web app and I hope to implement a qr scanner. I came across this library and it looks very robust. I installed it via npm and tried to require('cordova-plugin-qrscanner') as I have done with my other npm modules. I am kind of confused as to how this library can be integrated into my App or if its even possible. I am not using any front end frameworks. Am I completely missing something here? Any clarification would be great. Thanks!

@bitjson
Copy link
Contributor

bitjson commented Apr 7, 2017

Yes, you should be able to simply include the minified library on the page, and the proper methods will be added to the window object. It's distributed as in UMD format, so it should also work as expected with your CommonJS project.

Be sure to check out the Browser readme section platform for specific notes.

@bitjson
Copy link
Contributor

bitjson commented Apr 7, 2017

On another note – if you're trying to require it, your CommonJS loader may be looking inside package.json for a main field, which I'm just realizing isn't defined. Looking into that now.

bitjson added a commit that referenced this issue Apr 7, 2017
Allows for proper resolution by CommonJS

#83
@bitjson
Copy link
Contributor

bitjson commented Apr 7, 2017

Ok – I just added the property in this commit: 955e375

It should be included in the next release of cordova-plugin-qrscanner. Until then, you can get it working by adding the property to the package.json file in node_modules/cordova-plugin-qrscanner like in the commit:

...
"main": "dist/cordova-plugin-qrscanner-lib.min.js",
...

Please let me know if that solves the issue!

@bitjson bitjson self-assigned this Apr 7, 2017
@Naki21
Copy link
Author

Naki21 commented Apr 7, 2017

You beautiful, beautiful unicorn man. Seems to have worked like a charm This is going to work wonders in my app. This is by far the most robust and well maintained qr scanning library I have found. I appreciate the help and speedy response

@Naki21 Naki21 closed this as completed Apr 7, 2017
@bitjson
Copy link
Contributor

bitjson commented Apr 7, 2017

Glad to hear it, thanks for opening the issue!

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

No branches or pull requests

2 participants