Reputation: 11
I am developing a desktop app with Electron and Angular2 (using Angular-Cli).
I wanted to use Bootstrap so in my angular-cli.json, I added the needed script files to apps[0].scripts like the following:
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js",
"../node_modules/toastr/build/toastr.min.js"
],
When I run the app in web (using ng serve), everything is working fine. But when I run the app with Electron(ng build first, and run Electron from /dist), I encountered the following error: Uncaught Error: Bootstrap's JavaScript requires jQuery. Angular 2 parts are working fine, routing is working, views are rendered correctly, etc.
When I investigated scripts.bundle.js, those 3rd party libraries are included. But Bootstrap codes are before JQuery. Is that the reason why I am seeing the error with Electron?
Upvotes: 1
Views: 939
Reputation: 1
For me it worked to install both jquery and @types/jquery and placing them in this order.
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js"
],
~ HTH
Upvotes: 0
Reputation: 31
<script>
try {
window.nodeRequire = require;
delete window.require;
delete window.exports;
delete window.module;
} catch (e) {
}
</script>
add this into index.html
Upvotes: 2