0

There is this answer but it is wrong as it references tsconfig.json which is non-existant in vue projects now.

How do you import a JSON file with VueJS / Typescript?

I suspect the configuration option

{
  "compilerOptions": {
    "resolveJsonModule": true
  }
}

should go somewhere. Where?

1 Answer 1

3

tsconfig.json is used when you use TypeScript. If you used the Vue CLI to build your program, it should come with Webpack. With webpack => 2.0.0, json-loader comes by default, so you can load .json files directly with

import jsonObject from '/path/to/file.json';
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.