I'm trying to call
var player = fs.readFileSync("pdc-hatch-save.txt", "json").player;from the companion/index.js file - but I get this error:
fs is imported by companion/index.js, but could not be resolved
Is there a way to resolve the issue?
EDIT:
now all my fs imports are not working. This started becoming an issue when I moved some files to the common folder. Is there a reason I would be getting these errors?
Answered! Go to the Best Answer.
Best AnswerSilly me - you can't use the FileSystem for companion files, and these files were being imported by the companion index.js, so that's why the errors occured.
Removing the import in files used by the companion and fixed this up.
Best AnswerSilly me - you can't use the FileSystem for companion files, and these files were being imported by the companion index.js, so that's why the errors occured.
Removing the import in files used by the companion and fixed this up.
Best AnswerWhere did you end up importing the filesystem? Nevermind I worked around it. You can use anything you want in the Companion API as long as you rollup your js dependancies with commonjs. Also, if you use the /common/ directory in the app architecture that will share those dependancies between /app/ and /companion/. I will say its a huge pain in the **ahem** to get what you want out of rollup but its definitely the only way to get needed dependanxies for app development. I wish you could just add npm packages that were shared across the application like regular ReactJS.
Best Answer