How do you get the current path in Pages?
It looks like __dirname causes a 500 execption.
There is no wrangler file for Pages to set the Node JS compatibility to use path.resolve()
8 Replies
Not sure what you mean? Pages doesn't have a filesystem, so it doesn't have a path
You can request stuff from the asset server, but you aren't "in" any directories there
Ah that is what I was trying to do. Load a .json file as a JSON object
Is this in a Function?
If so, you can just import the JSON file directly
Instead of "reading" it
No inside of root.tsx for a remix project
Oh, that counts too, since Remix converts its server code to a Function
How can I just import it directly then?
You might need a type assertion, depending on how Remix handles that
Perfect thanks