In my vue project, I have a json file that I import into my script (typescript) with import jsonData from '@/assets/data1.json';
I can access its data and it works fine, but during the build I'm getting a ton of warnings like this one:
WARNING in /path/src/assets/data1.json
1:1 unused expression, expected an assignment or function call
> 1 | {
| ^
2 | "x123": {
3 | "name": "John Doe",
4 | "confirmed": true
What should I do to tell the compiler that the file is actually a json file and not javascript/typescript?
To get this to work I've already added
"resolveJsonModule": true,
"esModuleInterop": true
to tsconfig.json
as described here: https://stackoverflow.com/a/50830840/86845