I am making a game with html in node.js and want to have a json file containing all of the user's information (inventory, stats, etc). But when I try and using require, the console throws the error "Uncaught Error: Cannot find module 'playerstats.json'". I am using the electron package to run the app.
Here is the code:
var json = require('./playerstats.json')
var data = json.parse(json);
and here is the filesystem: enter image description here I am trying to read the json from char_creation.js
I tried changing the type string in package.json and it didn't work. I also tried using import to load it and fs.readfile and fs.readfilesync but those also didn't work.