我目前正在研究Electron with Babylon.我发现这个仓库我基本上用作我自己项目的样板.在我尝试添加jquery.pep.js以满足其他需求之前,一切运行良好.我继续犯这个错误:
未捕获错误:找不到模块'jquery.pep.js'
我用"npm i -S jquery"和"npm i -S jquery.pep.js"安装了两个库.为了使jquery工作,我在index.html的头部添加了这个脚本
<script> delete window.module; </script>
Run Code Online (Sandbox Code Playgroud)
这行在main.js的顶部:
window.$ = window.jQuery = require('jquery');
Run Code Online (Sandbox Code Playgroud)
现在,jquery工作正常,但由于某些原因,仍然无法找到jquery.pep.js模块.我尝试使用'require',但我有同样的错误
main.js
window.$ = window.jQuery = require('jquery');
var pep = require('jquery.pep.js');
Run Code Online (Sandbox Code Playgroud)
项目结构
css/
img/
js/
- main.js
node_modules/
index.html
index.js
package.json
renderer.js