Update README.md to reflect correct usage of "import"#337
Update README.md to reflect correct usage of "import"#337nickcmaynard wants to merge 1 commit intosoldair:masterfrom
Conversation
|
At the same time as doing this, it would be good to document a way to import in the browser. so that it can be used inside modules. For example imports fine but QRCode is a module, so for example there is no QRCode.toCanvas |
geeky01adarsh
left a comment
There was a problem hiding this comment.
Thank you for pointing it out, it worked for me.
|
For use in the browser, I moved to "qrcode-generator-es6" as I couldn't get this one to work. My examples using that module (which failed in using this one because of the problem above) are in https://github.com/mitra42/html-element-extended in qrelementextended.js - just the display part - the detect part still has some browser compability issues I'm working on. Note - ... not a criticism of this module, I posted my response before realizing the name of this module (node-qrcode) suggests its to run in the server under node, not in the browser. |
There are a number of issues: #281, #292, #242 which appear to be falling down on the import not working correctly.
The imports in these issues use:
import QRCode from 'qrcode'But this results in QRCode as being
undefined.As #281 and #186 state, this import appears to work:
import * as QRCode from 'qrcode'Ideally, the documented method would work, but it doesn't. Thus this PR updates the documentation to show the method that does work.