Select to view content in your preferred language

importing old style modules in typescript

321
0
05-29-2019 06:51 AM
LizEidsness
Regular Contributor

I am making a widget for 4.11 that relies on an older module and a plugin for that module.  The only way I appear to get it to work is to reference the two scripts in < script > tags in the starting index.html page.  However I would like to keep all dependencies entirely contained in the widget instead.  Is this even possible?

These are the scripts as they work at the end of my index.html

<script src='//cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.min.js'></script>
<script src='//cdnjs.cloudflare.com/ajax/libs/chartjs-plugin-annotation/0.5.7/chartjs-plugin-annotation.min.js'></script>

The annotation plugin for Chart.js is the most picky of the two and is what complicates this.  It needs to be loaded only after the first one has finished, I think because it's expecting Chart as a global.

Thanks

Tags (2)
0 Kudos
0 Replies