Confused about the script embed in ng2-charts

161 views Asked by At

I'm trying to get started with ng2-charts. I've never seen a .js embed from the node_modules directory before, as they specify here:

<script src="node_modules/chart.js/src/chart.js"></script>

I'm using Angular CLI. As far as I understood, the node_modules directory isn't served, and if it is, I do not know how to access it.

I did try duplicating those packages and linking to them in src/, but I get:

Uncaught ReferenceError: require is not defined
    at chart.js:4

I have no clue how this is supposed to work, so I tried to find a working example. Even in the project on Github, the only examples of this embed are in the ReadMe files.

0

There are 0 answers