-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
TypeError: Html5QrcodeScanner is not a constructor #270
Comments
I don't understand why you mention people. It might be me, but I think it is quite rude to do so. Certainly if people have not requested to make sure you ping them if you post something. Furthermore, I have hardly any experience with Angular. Unsubscribing from this issue to make sure I am not updated from any further comments. |
... That said, for our project, bundling was the issue. And we solved it using webpack externals. |
My sincere apologies, I mentioned you because I saw that you are contributor in making of this project. |
Can you verify with latest version of code with (I'll add more documentation later) |
This should have been fixed in latest version -
Please reopen if this is still an issue. |
this is still an issue with importing the JS file directly in angular.json (not using the npm package)
and getting the same error: |
The bug
I'm using Angular 12 toolkit with Ionic framework.
Followed the documentation but didn't understand why this error appears.
Used both npm command to installed the related modules plus I've linked JS file from assets folder as well but both ways it's not working.
Import from npm
import Html5QrcodeScanner from 'html5-qrcode'
Manual import to use JS file
declare var require: any; var Html5QrcodeScanner = require('html5-qrcode');
function onScanSuccess(decodedText, decodedResult) { // handle the scanned code as you like, for example: console.log(
Code matched = ${decodedText}`, decodedResult);}
Looking forward for guidance to improve my code. Thank you
@mebjas @gurubobnz @esin @dampee @jdtimmerman
The text was updated successfully, but these errors were encountered: