Skip to content

Commit

Permalink
patch "cannot find document variable" for react-native
Browse files Browse the repository at this point in the history
  • Loading branch information
roccomuso committed Oct 21, 2020
1 parent 0884b91 commit 4ea0aab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ child.on('exit', function(code){

// needed in order for the library to work in the browser
patchedLib += 'if (typeof module !== "undefined") { module["exports"] = Module; }'

// closes #31 - needed for react-native environment
patchedLib = patchedLib.replace('(document.currentScript)', '(typeof document !== "undefined" && document.currentScript)')

fs.writeFileSync('lib.js', patchedLib, 'utf-8')
})

0 comments on commit 4ea0aab

Please sign in to comment.