I have following requirejs config:
require.config({
baseUrl: '/js',
shim: {
...
highcharts: {
deps: ['highcharts-more'],
exports: 'Highcharts'
}
...
},
paths: {
...
'highcharts': 'http://code.highcharts.com/highcharts',
'highcharts-more': 'http://code.highcharts.com/highcharts-more'
...
}
});
Then in my view:
define([
...
'highcharts',
...
], function (Highcharts) {
// The speed gauge
// Example http://www.highcharts.com/demo/gauge-solid
$('#container-speed').highcharts(...);
});
In console i have:
ReferenceError: Highcharts is not defined
in highcharts-more.js
Any correct way how to load Highcharts-more.js with RequireJS?
Your dependencies are reversed. highcharts-more
depends on highcharts being loaded. Hence, make sure highcharts
is loaded as dependency( deps
) in deps
array:
highcharts-more: {
deps: ['highcharts'],
exports: 'Highcharts'
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.