Skip to content

Conversation

@jc-lab
Copy link

@jc-lab jc-lab commented Sep 24, 2019

Fix error caused by the wrong sourceRegex in webpack environment.

zxing.js?2fed:1 Uncaught TypeError: Cannot read property 'slice' of null
    at parseJSFunc (zxing.js?2fed:1)
    at eval (zxing.js?2fed:1)
    at module.exports (zxing.js?2fed:1)
    at eval (scanner.js?63ee:2)
    at Object../vendor/instascan/src/scanner.js (app.js:9060)
    at __webpack_require__ (app.js:727)
    at fn (app.js:101)
    at eval (index.js?aa2c:5)
    at Object../vendor/instascan/index.js (app.js:9038)
    at __webpack_require__ (app.js:727)

Fix

var sourceRegex = /^function\s*\(([^)]*)\)\s*{\s*([^*]*?)[\s;]*(?:return\s*(.*?)[;\s]*)?}$/;

Into

var sourceRegex = /^function\s*\S*\(([^)]*)\)\s*{\s*([^*]*?)[\s;]*(?:return\s*(.*?)[;\s]*)?}$/;

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

Successfully merging this pull request may close these issues.

1 participant