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