Search code examples
javascriptnpmchart.jscdndayjs

Chartjs adapter for Dayjs CDN: Uncaught ReferenceError: process is not defined


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


Solution

  • 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