I'm trying to get graphs onto my flask website using Chart.js. When I use the CDN link below everything functions perfectly; this should mean my code is fine.
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js" integrity="sha512-d9xgZrVZpmmQlfonhQUvTR7lMPtO7NkZMkA0ABN3PHCbKA5nqylQ/yWlFAyY6hYgdF1Qh6nYiuADWwKB4C2WSw=="crossorigin="anonymous"></script>
But when I try to access Chart.js in node_module, nothing works. The line below is what I'm using
<script src="{{ url_for('static', filename='node_modules/chartjs/dist/Chart.js') }}"></script>
This is my first time using npm, so I'm assuming I messed up somehow. I've installed npm, ran npm init
in static. After running, it looks like this. I then ran npm install chart.js --save
, it installed fine. Based off this answer, and this line <script src="path/to/chartjs/dist/Chart.js"></script>
from Chart.js, I should be fine.
What gives? Where can I start looking to figure the problem. I've seen other