I've created a vue.js with typescript app using vue-cli
3 and selecting the typescript option.
Now I'm trying to import a .json file:
import * as config from './config.json';
But keep getting the compiler error:
Version: typescript
2.7.17:25, tslint 5.9.1
Cannot find module './config.json'.
The config.json
file is right next to the .ts
that is trying to load it.
Is there any additional config I need to add to load .json with the vue-cli templates?
Add "resolveJsonModule": true to your tsconfig.json
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With