-
Notifications
You must be signed in to change notification settings - Fork 867
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
Cannot read property 'slice' of null (Create React App project) #154
Comments
Hi, just to give more info about the problem. In the create-react-app example from @lnhrdt , if you just overwrite the entire index.js with... import {Camera} from "instascan";
Camera.getCameras().then(cameras => console.log(cameras)); ...the error will happen. |
Thanks for the extra info @rubenspgcavalcante! I just updated the example repo to remove the |
Good insight @rubenspgcavalcante, seems likely. The instascan author hasn't participated in that discussion yet. @schmich do you have any insight in to this issue (which may be related to #121)? Your thoughts would be helpful here! |
Error comes from a syntax change during transpilation. in zxing.js, replace: by: worked for me. |
+1 |
That didn't work for me @karenjwap , but pointed me in the right direction. Essentially an object with function as values gets turned into strings, then parsed for their arguments, body and return value. tldr Anyway, here's the solution: Replace the /^function[^\(]*\(([^)]*)\)\s*{\s*([^*]*?)[\s;]*(?:return\s*(.*?)[;\s]*)?}$/ Or just use a fork: |
- set sourceRegex to /^function[^\(]*\(([^)]*)\)\s*{\s*([^*]*?)[\s;]*(?:return\s*(.*?)[;\s]*)?}$/ (see schmich#154 for more details)
instascan
throws an error in my projects:The projects are created with Create React App 2. CRA2 is currently in alpha but is otherwise very stable and
instascan
is the first dependency I've come across that does not work. Perhaps the issue is withininstascan
.I originally reported an issue in
react-instascan
(rubenspgcavalcante/react-instascan/issues/9) but the author looked into it and believes the issue is withininstascan
.I've created a repository that reproduces the error:
https://github.com/lnhrdt/react-instascan-error
Any ideas?
The text was updated successfully, but these errors were encountered: