ozsay / angular-electron

angularjs helpers for electron apps
MIT License
41 stars 12 forks source link

Module won't load because window.require is unavailable #11

Open eltonjude opened 7 years ago

eltonjude commented 7 years ago

Due to a know issue with Electron (look for "jQuery/RequireJS/Meteor/AngularJS" here http://electron.atom.io/docs/faq/) the recommendation on Electron FAQ is to rename window.require to something else. However, because of this, angular-electron module won't load throwing error:

Error: [$injector:modulerr] Failed to instantiate module angular-electron due to:
TypeError: electronRequire is not a function

If you could make an assumption that the require was renamed to nodeRequire and changed this line: https://github.com/ozsay/angular-electron/blob/master/angular-electron.js#L109 to

(window.angular, window.require || window.nodeRequire, window.process);

things should work out fine.

rhclayto commented 7 years ago

I did the same thing in my fork: https://github.com/rhclayto/angular-electron