javascript - Loading libraries and additional modules with requirejs -


i'm struggling understand how load external library , additional module using requirejs.

this have:

this works ok, doesn't seem right me:

requirejs.config({   paths: {       highcharts: 'http://localhost:3000/hicharts/js/highcharts'   } }); requirejs.config({   paths: {       exporting: 'http://localhost:3000/hicharts/js/modules/exporting'   } }); 

i sort of expecting have worked:

require.config({   paths: {       highcharts: 'http://localhost:3000/hicharts/js/highcharts',       exporting: 'http://localhost:3000/hicharts/js/modules/exporting'   } }); 

but doesn't seem expose exporting module, though gets called web server. missing here, , know documented ? can't seem find discusses it.

there highcharts npm package contains highcharts, highstock , highmaps plus modules. start installing highcharts node module , save dependency in package.json:

npm install highcharts --save

load require:

var highcharts = require('highcharts'); // load module after highcharts loaded require('highcharts/lib/modules/exporting')(highcharts); // create chart highcharts.chart('container', { /*highcharts options*/ }); 

more information , examples can found in highcharts general documentation , highcharts article.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -