JQuery Electronic Errors

I am working on an Electron project, and when I try to enable jQuery, I get this error:

C:\Users\Matthew\Documents\Electron\ElectronProjects\Iris\js\jquery.min.js:4 Uncaught SyntaxError:
C:\Users\Matthew\Documents\Electron\ElectronProjects\Iris\js\jquery.min.js:4 b),b&&a.jQuery===n&&(a.jQuery=Hb),n},b||(a.jQuery=a.$=n),n});jQuery v3.0.0-pre

I tried to use the method recommended on the page "Problems with Electrons" (window. $ = Window.jQuery = require ('./../js/jquery.min.js');). This always causes this error.

Any ideas?

+4
source share
3 answers
<script type="text/javascript">
    window.$ = window.jQuery = require(__dirname+'/js/jquery.js');
</script>

I used this for jquery version 1.9.1, this works great.

+6
source

It seems like adding "node-integration": falseto my constructor BrowserWindow fixed it. I would still like to explain why I should do this, though :)

+5
source

"", : https://github.com/atom/electron/issues/254

"jQuery ...

if ( typeof module === "object" && typeof module.exports === "object" ) 
{
  // set jQuery in `module`
} 
else
{
  // set jQuery in `window`
}

detected even in browser side scripts. This causes jQuery to ignore the window object and use the module, so other scripts will not find $ or jQuery in the global scope. "

+2
source

All Articles