chartjs-plugin-datalabels
chartjs-plugin-datalabels copied to clipboard
chartjs-plugin-datalabels with requirejs (ReferenceError: module is not defined)
Hello guys,
I'm currently trying to set up chartjs 3 + chartjs datalabels 2 along with requirejs, and I'm getting the following errors:
helpers.js:1 Uncaught ReferenceError: module is not defined
chartjs-plugin-datalabels.min.js:7 Uncaught TypeError: Cannot read properties of undefined (reading 'merge')
Here's my requirejs config:
requirejs.config({
paths: {
'chartjs': '../vendor/chart.js/dist/chart.min',
'chartjs-plugin-datalabels': '../vendor/chartjs-plugin-datalabels/dist/chartjs-plugin-datalabels.min',
},
shim: {
'chartjs-plugin-datalabels': {
deps: ['chartjs']
},
},
map: {
'chartjs-plugin-datalabels': {
"chart.js": "chartjs",
"chart.js/helpers": "../vendor/chart.js/helpers/helpers"
}
}
});
Everything was working well with chartjs 2 + chartjs datalabels 1, but with this upgrade, it's not anymore. I'm guessing it has to do with the module.exports = require('..').helpers; in helpers.js, but I don't know how to fix this.
Can you help me? Thanks a lot
@andrepintado It looks like something specific to require.js so it may be better to ask this question in their repository. If you think there is a bug in this library, please provide a way for us to reproduce and debug your issue.