question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loading using Require.js (AMD) broken

See original GitHub issue

Codepen

Just open this codepen and check the dev-console (F12):

image

Explanation

I think that SVG is not defined because there is something wrong on module bundler. Do i need to include SVG.js as external library?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:23 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
wicked539commented, Nov 11, 2019

I stumbled across the same issue, here’s my workaround:

require.config({
  baseUrl: ".",
  paths: {
    "ApexCharts": "https://cdn.jsdelivr.net/npm/apexcharts@3.10.1/dist/apexcharts",
    "svg": "https://cdn.jsdelivr.net/npm/svgjs@2.6.2/dist/svg.min"
  }
});

require(['svg', 'ApexCharts'], function (svg, ApexCharts) {
  var myChartOpts = {...};
  var myChart = new ApexCharts(document.querySelector("#myChart"), myChartOpts);
  myChart.render();
});

Hope this helps!

0reactions
epykurecommented, May 24, 2021

Is this issue fixed ? I am also facing this issue when I am trying to use ApexCharts from Jupyter.

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it wrong to use requirejs (AMD) in a synchronous way?
Short answer: yes, it is wrong. You use require.js to first load all your dependencies, and then once all of them are loaded, ......
Read more >
Common Errors - RequireJS
This fails because requirejs needs to be sure to load and execute all dependencies before calling the factory function above. If a dependency...
Read more >
Moodle in English: Issue loading external script with requirejs
Hey guys,. I am running Moodle 3.6.3 and really struggling with trying to add an external javascript link to my site.
Read more >
Why is js breaking with requirejs in templates on Magento 2 ...
app/design/frontend/Smartwave/porto_child and put in the following: ... Because of which, when JS files that require JQuery are loaded, ...
Read more >
Writing Modular JavaScript With AMD, CommonJS & ES ...
There are a number of great loaders for handling module loading in the AMD and CJS formats, but my personal preferences are RequireJS...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found