2016-12-29 52 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加載到相應的位置 –

相關問題