Created
February 3, 2019 20:05
-
-
Save taylor8294/75e665ed0acb1bd93bf0e5628619d4b7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Postinstall script to ensure jQuery loads in the window object when using in Electron (not in module.exports) | |
| // See https://stackoverflow.com/questions/32621988/electron-jquery-is-not-defined | |
| const fs = require('fs'); | |
| const f_jquery = 'node_modules/jquery/dist/jquery.min.js'; | |
| fs.readFile(f_jquery, 'utf8', function (err, contents) { | |
| if (err) { | |
| return console.log(err); | |
| } | |
| var result = contents.replace('"use strict";"object"==typeof module&&"object"==typeof module.exports?', '"use strict";false?'); | |
| fs.writeFile(f_jquery, result, 'utf8', function (err) { | |
| if (err) return console.log(err); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment