Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chartjs-plugin-datalabels with requirejs (ReferenceError: module is not defined) #314

Open
andrepintado opened this issue Apr 20, 2022 · 1 comment

Comments

@andrepintado
Copy link

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

@simonbrunel
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants