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

$exports is not defined #33

Open
handkerchief333 opened this issue May 20, 2023 · 3 comments
Open

$exports is not defined #33

handkerchief333 opened this issue May 20, 2023 · 3 comments

Comments

@handkerchief333
Copy link

I use "npm run build" to get the advantage of the bundle size. In my JS file I imported the ChartDeferred as follows:

import {
  Chart,
  Tooltip,
  Colors,
  BarController,
  CategoryScale,
  LinearScale,
  BarElement,
  Legend,
  BubbleController,
  PointElement,
} from 'chart.js';
import ChartDeferred from 'chartjs-plugin-deferred';

Chart.register(
    Tooltip,
    Colors,
    BarController,
    BarElement,
    CategoryScale,
    LinearScale,
    Legend,
    BubbleController,
    PointElement,
    ChartDeferred,
);

Without the ChartDeferred, the charts are working perfectly, but with ChartDeferred imported, this error appears and I can't get rid of this:

Uncaught ReferenceError: $50e8ddfc489f09fc$exports is not defined
    so chartjs-plugin-deferred.esm.js:83
    beforeInit chartjs-plugin-deferred.esm.js:98
    beforeInit chartjs-plugin-deferred.esm.js:144
    $ helpers.core.ts:109
    _notify core.plugins.js:60
    notify core.plugins.js:42
    notifyPlugins core.controller.js:1148
    _initialize core.controller.js:251
    on core.controller.js:204
    <anonymous> cc-chart.js:42

chart.js = 4.3.0
chartjs-plugin-deferred = 2.0.0

my package.json:

{
  "name": "example",
  "version": "1.0.0",
  "license": "MIT",
  "scripts": {
    "dev": "parcel src/index.html --no-content-hash",
    "build": "parcel build src/index.html --no-content-hash"
  },
  "devDependencies": {
    "parcel": "^2.6.2"
  },
  "dependencies": {
    "@cubejs-client/core": "^0.31.0",
    "chart.js": "^4.0.0",
    "chartjs-plugin-deferred": "^2.0.0"
  }
}
@gregh3269
Copy link

For me using the umd version fixed the export issues.

@handkerchief333
Copy link
Author

For me using the umd version fixed the export issues.

@gregh3269 Thank you very much for your fast response. Maybe a stupid question, but can you describe to me exactly how to do this with my chosen integration?

@gregh3269
Copy link

No sure it is related, its only a suggestion, for me it only seems works with
http://cdn.jsdelivr.net/npm/[email protected]/dist/chart.umd.js

maybe the "chart.js": "^4.0.0", defaults to the esm version?

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

No branches or pull requests

2 participants