3rd party scripts are not loading in Electron
Hi, we are using an Angular web-solution with Electron. In this solution we used Bootstrap and defined this scrips in the angular-cli.json. This works in the regular browser, but not in an Electron environment. We received the following errors in Electron: Uncaught Error: Bootstrap's JavaScript requires jQuery EXCEPTION: Error in :0:0 caused by: $ is not defined ORIGINAL EXCEPTION: $ is not defined ...
OS?
Windows 8.1
Versions.
node --version v6.10.0 ng -v 1.0.0-beta.28.3
"dependencies": { "@angular/common": "^2.3.1", "@angular/compiler": "^2.3.1", "@angular/core": "^2.3.1", "@angular/forms": "^2.3.1", "@angular/http": "^2.3.1", "@angular/platform-browser": "^2.3.1", "@angular/platform-browser-dynamic": "^2.3.1", "@angular/router": "^3.3.1", "bootstrap-material-design": "^0.5.10", "core-js": "^2.4.1", "jquery": "^3.1.0", "rxjs": "^5.0.1", "ts-helpers": "^1.1.1", "zone.js": "^0.7.2" }, "devDependencies": { "@angular/compiler-cli": "^2.3.1", "@types/electron": "^1.4.33", "@types/jasmine": "2.5.38", "@types/node": "^6.0.42", "angular-cli": "1.0.0-beta.28.3", "codelyzer": "~2.0.0-beta.1", "jasmine-core": "2.5.2", "jasmine-spec-reporter": "2.5.0", "karma": "1.2.0", "karma-chrome-launcher": "^2.0.0", "karma-cli": "^1.0.1", "karma-jasmine": "^1.0.2", "karma-remap-istanbul": "^0.2.1", "protractor": "~4.0.13", "ts-node": "1.2.1", "tslint": "^4.3.0", "typescript": "~2.0.3", "@types/jquery": "^2.0.33" }
Repro steps.
Add external scripts (Bootstrap as example) and define it in angular-cli.json. Start this Application in Electron. Open the developer tools with [Ctrl] + [Shift] + I and see the error messages in the output.
Electron uses node to work, therefore jQuery has a conflict in the declaration due to module, So you can solve it like this. http://ourcodeworld.com/articles/read/202/how-to-include-and-use-jquery-in-electron-framework
Closing as answered by @JiaHongL, thanks!
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.