javascript - how to change baseUrl path in init.js -
i need define nodejs library (from pr_name/node_modules/lib_name
). @ pr_name/static/js/init.js
file defined baseurl
path:
baseurl: 'static',
then defined paths
@ static dir. how can add node library different path?
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 @ static @ node_modules }
upd.
'xlsx-chart': '/node_modules/xlsx-chart/chart',
and
'xlsx-chart': '../node_modules/xlsx-chart/chart',
both gives me error @ browser console.
require.js:165 uncaught error: script error "xlsx-chart", needed by: export-stats
where export-stats has xlsx-chart require:
define(['xlsx-chart'], function(xlsxchart){ ....
i can't understand source of problem.
upd.upd. understand - site python
's , of used urls must defined @ urls.py
. , 'xlsx-chart'
goes own url same node.js
-library.
depending on how server serves data configured, use absolute path:
'xlsx-chart': '/node_modules/xlsx-chart'
if node_modules
not @ root of server serves, relative path can work , perhaps nicer in cases:
'xlsx-chart': '../node_modules/xlsx-chart'
i've used both.
Comments
Post a Comment