Recently, I have been attempting to incorporate amcharts into my project using npm. After running the command npm install@amcharts/amcharts4, I noticed that all the necessary modules were now present in my node_modules folder and package.json file. Specifically, I found this line added to my package.json: "@amcharts/amcharts4": "^4.10.22". To set up my project, I created two essential files - index.html and charts.js. Within my app.js, I made sure to include the following lines:
import * as am4core from "@amcharts/amcharts4/core";
import * as am4charts from "@amcharts/amcharts4/charts";
import am4themes_animated from "@amcharts/amcharts4/themes/animated";
However, despite including my charts.js file in my index.html using the script tag below:
<script src="charts.js"></script>
I consistently encounter a syntax error mentioning: "Uncaught SyntaxError: Cannot use import statement outside a module". This issue persists, and I remain unable to resolve it. If anyone has any insight into what might be causing this problem, your help would be greatly appreciated. Thank you in advance.