Skip to main content

jQuery JQuery error in Electron: '$ is not defined'

I am currently building a Flask webappweb app using pyinstaller, and I've been trying to get it to work on Electron. The project uses jQuery and Bootstrap along with a couple of other libraries.

The problem is that I've been getting two errors:

TypeError: Cannot read properties of undefined (reading 'fn') ($.fn.emulateTransitionEnd = transitionEndEmulator)

ReferenceError: $ is not defined

This prevents me from using certain features of the website.

Things I've tried:

<!-- Insert this line above script imports  -->
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>

<!-- normal script imports etc  -->
<script src="scripts/jquery.min.js"></script>    
<script src="scripts/vendor.js"></script>    

<!-- Insert this line after script imports -->
<script>if (window.module) module = window.module;</script>
  • Ensure jQuery loads. It loads from /bootstrap/static/jquery.min.js.
  • Add the lines nodeIntegration = true and contextIsolation = false.
  • When running the Flask executable and opening the website on my browser, the $ is not defined error does not show up and works correctly.
  • Checked the order of imports for jQuery and other scripts.

Some help would be deeply appreciated!

jQuery error in Electron: '$ is not defined'

I am currently building a Flask webapp using pyinstaller, and I've been trying to get it to work on Electron. The project uses jQuery and Bootstrap along with a couple other libraries.

The problem is that I've been getting two errors:

TypeError: Cannot read properties of undefined (reading 'fn') ($.fn.emulateTransitionEnd = transitionEndEmulator)

ReferenceError: $ is not defined

This prevents me from using certain features of the website.

Things I've tried:

<!-- Insert this line above script imports  -->
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>

<!-- normal script imports etc  -->
<script src="scripts/jquery.min.js"></script>    
<script src="scripts/vendor.js"></script>    

<!-- Insert this line after script imports -->
<script>if (window.module) module = window.module;</script>
  • Ensure jQuery loads. It loads from /bootstrap/static/jquery.min.js.
  • Add the lines nodeIntegration = true and contextIsolation = false.
  • When running the Flask executable and opening the website on my browser, the $ is not defined error does not show up and works correctly.
  • Checked the order of imports for jQuery and other scripts.

Some help would be deeply appreciated!

JQuery error in Electron: '$ is not defined'

I am building a Flask web app using pyinstaller, and I've been trying to get it to work on Electron. The project uses jQuery and Bootstrap along with a couple of other libraries.

The problem is that I've been getting two errors:

TypeError: Cannot read properties of undefined (reading 'fn') ($.fn.emulateTransitionEnd = transitionEndEmulator)

ReferenceError: $ is not defined

This prevents me from using certain features of the website.

Things I've tried:

<!-- Insert this line above script imports  -->
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>

<!-- normal script imports etc  -->
<script src="scripts/jquery.min.js"></script>    
<script src="scripts/vendor.js"></script>    

<!-- Insert this line after script imports -->
<script>if (window.module) module = window.module;</script>
  • Ensure jQuery loads. It loads from /bootstrap/static/jquery.min.js.
  • Add the lines nodeIntegration = true and contextIsolation = false.
  • When running the Flask executable and opening the website on my browser, the $ is not defined error does not show up and works correctly.
  • Checked the order of imports for jQuery and other scripts.

Some help would be deeply appreciated!

Source Link

jQuery error in Electron: '$ is not defined'

I am currently building a Flask webapp using pyinstaller, and I've been trying to get it to work on Electron. The project uses jQuery and Bootstrap along with a couple other libraries.

The problem is that I've been getting two errors:

TypeError: Cannot read properties of undefined (reading 'fn') ($.fn.emulateTransitionEnd = transitionEndEmulator)

ReferenceError: $ is not defined

This prevents me from using certain features of the website.

Things I've tried:

<!-- Insert this line above script imports  -->
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>

<!-- normal script imports etc  -->
<script src="scripts/jquery.min.js"></script>    
<script src="scripts/vendor.js"></script>    

<!-- Insert this line after script imports -->
<script>if (window.module) module = window.module;</script>
  • Ensure jQuery loads. It loads from /bootstrap/static/jquery.min.js.
  • Add the lines nodeIntegration = true and contextIsolation = false.
  • When running the Flask executable and opening the website on my browser, the $ is not defined error does not show up and works correctly.
  • Checked the order of imports for jQuery and other scripts.

Some help would be deeply appreciated!