0

I have about 10 JSON files now but can be changed as times goes by. Their content differs but structure is the same. Here is the method that processes a specific file:

_process(id) {
  const source = require(`../../assets/${id}.json`)
}

The above fails at compilation because it is not found. I can't import the files at the top cos out of the files, may be 2-3 are needed, hence the imports would be unnecessary. But still happy to hearing a way forward. At most 4 files are needed by the user based on role.

Józef Podlecki
  • 10,453
  • 5
  • 24
  • 50
Wede Asmera Tseada
  • 513
  • 2
  • 4
  • 14

0 Answers0