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:
- Tried the solution from Question [#32621988]
<!-- 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
andcontextIsolation = 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!