How do you correctly load a JSON file from disk in a UXP script?
I'm not a JavaScript or UXP expert, most likely I'm doing something obvious wrong here. But I haven't been able to find an answer for this anywhere.
Here's how I attempt to load the JSON:
const fs = require('fs');
const data = JSON.parse(fs.readFile("path/to/file.json"));
However, the last line gives the error "Unexpected token o in position 1" and the script quits.
I have double-checked the file path and made sure it is correct. Also, if I copy/paste the JSON directly into the script everything works correctly, so I know the file is not corrupt.
What is wrong here?
