I have been using jQuery, bootstrap, select2 within Electron Framework Project. Recently, I updated NodeJs and npm, then started experiencing problem with loading select2 package. I am getting this error: "Uncaught TypeError: (...).select2 is not a function." whenever select2 function is called. I have searched, read and tried several solutions. So far I have tried, checking the order of (jQuery, Bootstrap and select2) being loaded that specific order, different versions of jQuery are not being attached to the html page, downloading all packages and using in the file through local path, manually trying to add select2 to .fn object. But nothing works for me. I also tried removing node_modules, clearing npm cache and installing everything. But that also didn’t help.
When I opened index.html file in the chrome browser, I see no error and select2 is loaded and I also see it in the Object $.fn. But when I started the electron project, it is giving me the same error as I was getting previously with my project. I am using Node v8.9.1, npm 5.5.1 (installed through homebrew).
I would appreciate any insights, link to any other posts which I might have missed and any suggestions to resolve this issue.