2016-12-29 50 views
1

我认为它已准备好投入生产并在途中遇到错误,我将Angular2-Electron应用打包了起来。出现的错误是我的引导带和JQuery无法找到。现在我通过node_modules将其加载到index.html中。这工作很好,直到我不得不打包。在本地加载JQuery和bootstrap以便我的电子应用程序可以找到它的最佳方式是什么? 我得到的错误是错误找不到模块 我理解为什么,这是因为当电子打包东西时,一切都移动到一个文件,我只是不知道何时何地加载引导程序和JQuery到对应的位置如何在电子应用中实现JQuery和Bootstrap

的index.html:

<script>window.$ = window.jQuery = require('../node_modules/jquery/dist/jquery.min.js');</script> 

<script src="../node_modules//bootstrap/dist/js/bootstrap.min.js"></script> 

<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap.min.css"> 

<link rel="stylesheet" href="../node_modules/bootstrap/dist/css/bootstrap-theme.min.css"> 

回答

0

SCRIPT SRC = “http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js”

此链接可帮助jquery将您的项目与引导元素同步d仅适用于互联网连接。

1

单独要求是不够的,加载了jQuery,你将不得不额外引用您的文件中的一个标签:

<script>window.$ = window.jQuery = require('../node_modules/jquery/dist/jquery.min.js');</script> 
<script src="../node_modules/jquery/dist/jquery.min.js"></script> 

您也应该确保所有的路径是正确的(你有一个双/中你的bootstrap.min.js参考)

+0

嗯,它在这之前工作100%,但我也这样做,仍然得到: –

+0

我明白了原因,这是因为当电子包东西时,一切都被移动到一个文件,我只是不知道何时何地将bootstrap和jquery加载到相应的位置 –

相关问题