Closed flexchar closed 6 months ago
Okay, I had trailing commas. They're automatically removed by my IDE on JSON files so I am blind to them. Perhaps something like json5
could be used instead of JSON.parse
?
PS. I've also confidently observed that correcting incorrect file will not relieve error unless CLI npm run dev
is stopped and started manually.
I think it'd be nice to use json5 if we can, not sure if it would have side effects, I'll try it out.
Not the first time we faced this issue, so I took the time to open this PR let me know if it solves your issues.
It definitely does, and I agree on a dedicated config file. I tried using .env
with docker compose and it rejected the approach. I've been thinking one could also inject MODELS variable using Vite config from a dedicated models.ts file. That would provide type hinting and flexibility to trailing commas without any addition dependencies. What do you think about that? :)
Merged the other pr! I think a rework of the settings is in order, so we'll definitely think about all this, I´d be curious to know what the community prefers for organizing config settings.
Hi! I've tried this end of October and now giving another shot. Both times I end up facing issues with getting the config right as I want because of various JSON parsing issues...
This is what I'm stuck with at the time of writing this issue and same I had in the past
It appears that something goes wrong and it's impossible to see where is the typo or if there is even one. While this is my config. I understand that I might be missing an obvious syntax thing for JSON but squeezing json in env makes it extremely hard.
As this issue is opened, I would like to propose handling JSON data in a dedicated config file such as models.json, or even better,
models.ts
that would be imported. This would allow to tap into existing editing tools to verify the syntax. The very least I'd like to suggest to print an exact location for faulty json to assist in debugging. The current error message is arguably useless.I did search for such issue but Github returned no results, I am quite surprised that as popular as the project is, no one else has bumped into.
Related: