import json file in script



  • Re: [json file](get data from script)

    Hi,
    I see that 4 years ago, the solution for getting a json file's content in a script was to use readFileSync.
    Is there a way to use --resolveJsonModule somehow, so I'll be able to require the file like this:

    import * as mockedFetchData from './mockedFetchData.json';
    


  • The ES modules support isn't available yet.
    Use the readFile.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.