javascripthtmllocalizationchart.jsoffline

Localize chart.js


(I don't want to use node, and npm)

I want to download chart.js on my own machine, so I can run it offline. I downloaded the cdn from here. I import it like this, in html:

<script type="importmap">
        {
          "imports": {
            "three": "./vendor/three.module.js",
            "gltf": "./vendor/GLTFLoader.js",
            "chart": "./vendor/chart.umd.min.js"
          }
        }
</script>

but then in an example chartComposit.js file I can't use it, as it throws me this error: chartComposit.js:1 Uncaught SyntaxError: The requested module 'chart' does not provide an export named 'default'

In js I import like this: import Chart from 'chart';

This same method worked with three.js so I don't understand, why it does not work like this here.

Thanks for any help!


Solution

  • I messed up the import line. Here is the correct one: import * as m_chart from 'chart';