0
我需要定義一個nodejs庫(從pr_name/node_modules/lib_name
)。在我pr_name/static/js/init.js
文件我定義了一個baseUrl
路徑:如何更改init.js中的baseUrl路徑
baseUrl: 'static',
然後我定義的靜態DIR一些paths
。我怎樣才能從不同的路徑添加節點庫?
require.config({
baseUrl: 'static',
paths: {
'jquery': 'libs/jquery/dist/jquery.min',
'jquery.maskedinput': 'libs/jquery.maskedinput/dist/jquery.maskedinput.min',
'bootstrap': 'libs/bootswatch-dist/js/bootstrap.min',
'xlsx-chart': '???' // <-- not at static but at node_modules
}
Upd。
'xlsx-chart': '/node_modules/xlsx-chart/chart',
和
'xlsx-chart': '../node_modules/xlsx-chart/chart',
都讓我在瀏覽器控制檯錯誤。
require.js:165 Uncaught Error: Script error for "xlsx-chart", needed by: export-stats
其中出口統計有XLSX,圖表要求:
define(['xlsx-chart'], function(XLSXChart){
....
我無法理解的問題的根源。
Upd.Upd。 現在我明白了 - 我的網站是python
的,所有使用的網址必須定義在urls.py
。和'xlsx-chart'
去像自己的網址一樣node.js
-library。
我在瀏覽器控制檯遇到一個奇怪的錯誤。我已經更新了一個問題。 – Mae