Electron: jQuery is not defined

前端 未结 19 2926
我在风中等你
我在风中等你 2020-11-22 06:20

Problem: while developing using Electron, when you try to use any JS plugin that requires jQuery, the plugin doesn\'t find jQuery, even if you load in the correct path using

19条回答
  •  梦谈多话
    2020-11-22 06:52

    im building and Angular App with electron, my solution was the following:

    index.html

    
    

    angular.json

    "scripts": [
                  "node_modules/jquery/dist/jquery.min.js",
                  "node_modules/popper.js/dist/umd/popper.min.js",
                  "node_modules/bootstrap/dist/js/bootstrap.min.js"
                ]
    

    So Jquery gets loaded from angular.json if on browser, else if it is an electron builded app it will require module instead.

    If you want to import jquery in index.html instead of importing from angular.json use the following solution:

    
    
    

提交回复
热议问题