I am in need of using mock JSON data to test the rendering of my front-end.
import MOCK_FAQ from '../../mocks/FAQ.json';
However, when attempting to import the file, I encountered this exception:
Cannot find module '../../mocks/FAQ.json'. Consider using '--resolveJsonModule' to import modules with '.json' extensions (2732)
I have already configured the necessary properties in my tsconfig file:
{
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"isolatedModules": true,
"jsx": "react",
"lib": [
"dom",
"es6"
],
"moduleResolution": "node",
"noEmit": true,
"strict": true,
"target": "esnext"
},
"exclude": [
"node_modules",
"babel.config.js",
"metro.config.js",
"jest.config.js"
]
}
Is there anyone who can provide assistance? o/