I can't import anything in my javascript files of my website, I've tried many things but it doesn't work.
So I want to import a .json file to a .js file using the import
key word but it doesn't work. Another problem is that Visual Studio Code doesn't show me an error but the console does...
main.js import part
import dropDownList from "./navigationList.json"; //This is line number 1
console.log(dropDownList.shop.kits);
navigationList.json file
{
"shop": {
"kits": "DIY Physics Kits",
"merch": "Merchendise"
},
"learn": {
"first-sub": "Mechanics",
"second-sub": "Miscellaneous"
}
}
Error the console is showing:
mainJS.js:1 Uncaught SyntaxError: Unexpected identifier
The console says there is an Uncaught SyntaxError with my import and this causing me to make my code long and without import which sucks. Please help me