I'm converting use of one our dependencies from bundled to 'get this from cdn'.
Working bundled code:
import ApexCharts from 'apexcharts';
let chart = new ApexCharts(....);
chart.render();
I'm refactoring that to try and load apexcharts from their CDN by using a dynamic import:
let ApexCharts = await import ('https://cdn.jsdelivr.net/npm/apexcharts')
That 'works' in the sense that I can tell via the console that it's loading the module, but I'm not sure how I can use it like I was before. Here's some console output that may help show what's happening:
> let ApexCharts = await import ('https://cdn.jsdelivr.net/npm/apexcharts')
< undefined
> ApexCharts
< Module {Symbol(Symbol.toStringTag): 'Module'}
> ApexCharts.default
< undefined
> ApexCharts.default()
< VM795:1 Uncaught TypeError: ApexCharts.default is not a function
at <anonymous>:1:19
(anonymous) @ VM795:1
> new ApexCharts.default()
< VM817:1 Uncaught TypeError: ApexCharts.default is not a constructor
at <anonymous>:1:1
(anonymous) @ VM817:1
So it loads (confirmed in network tab), but I don't know how to actually use it like I was before.