3

I'm using the CDN for the adapter for Chartjs to utilize Dayjs (chartjs-adapter-dayjs-4) and I'm getting the error Uncaught ReferenceError: process is not defined

I need to be able to use the CDN link for the Javascript that I'm writing, but I can't control the code in the CDN to define process.

Why won't this work and how can I fix it? Here's a link to the CDN source I'm using:

https://www.jsdelivr.com/package/npm/chartjs-adapter-dayjs-4

And here is the line from my HTML linking to it:

<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-dayjs-4/dist/index.min.js"></script>

Note: I'm not using Node.js

Changing the version doesn't seem to work, neither does switching from "Default" to "ESM".

1 Answers1

1

looking through the files that are in the build it seems like you will need to use the following link instead as the source: https://cdn.jsdelivr.net/npm/chartjs-adapter-dayjs-4@1.0.4/dist/chartjs-adapter-dayjs-4.cjs.production.min.js

LeeLenalee
  • 27,463
  • 6
  • 45
  • 69
  • 1
    This gives me yet another error: `Uncaught ReferenceError: require is not defined at chartjs-adapter-dayjs-4.cjs.production.min.js:1:90`. It's worth noting that `require` shows up a number of times after that line as well. Is this fixable? I find it hard to believe that a package like this would be put in a CDN while being this difficult to work with. – chugdawater Apr 28 '23 at 19:41