Answers for "typescript load json file"

5

Cannot find module './data.json'. Consider using '--resolveJsonModule' to import module with '.json' extension

add to tsconfig.json

{
	...
    "resolveJsonModule": true
  }
}
Posted by: Guest on July-30-2020
1

import json typescript

// add this in your tsconfig.json file:
{
  "compilerOptions": {
    "resolveJsonModule": true
  }
}
Posted by: Guest on October-01-2021
0

typescript read json file

"resolveJsonModule": true,
"esModuleInterop": true,
Posted by: Guest on December-18-2020
2

typescript how to mode json files when compile

{
  "compilerOptions": {
     "resolveJsonModule": true,
   },
   "include": [
     "*/src/**/package.json"
  ]
}
Posted by: Guest on January-02-2021
0

typescript read json file

import {default as a} from "config.json";
config.targetKey
// this requires `"resolveJsonModule": true` in tsconfig.json
Posted by: Guest on January-15-2021
-2

how to import a json string from a file in typescript

import {default as a} from "a.json";
a.primaryMain
Posted by: Guest on June-16-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language