Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use JSON, if it exists, otherwise fallback to Jason #75

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joshk
Copy link

@joshk joshk commented Dec 21, 2024

I'm unsure if this is the best approach, so consider this more of a draft than a complete solution.

The intent is to use the JSON module from Elixir 1.18.x instead of Jason, but I've kept the Jason dep as the fallback.

I do think it would be better to have Jason as an optional dep and have the project which is using Esbuild include Jason instead, but this would also require changes when creating new Phoenix projects to make sure Jason is added in the deps.

@joshk joshk changed the title Use JSON if it exists Use JSON, if it exists, otherwise fallback to Jason Dec 21, 2024
@josevalim
Copy link
Member

Hi @joshk!! We definitely want to do this but, because we cannot require v1.18 (it is too new), we need to depend on Jason anyway, so there isn't much benefit. My suggestion is to simply replace Jason by JSON in the future, but we will probably have to wait two years for doing so.

Other than that, I hope you are doing well and happy holidays!

@Eiji7
Copy link

Eiji7 commented Jan 6, 2025

@josevalim I understand we can't require using latest Elixir version, but we can optionally support it, right? The jason dependency should be optional and after said 2 years completely removed. If all libraries would do so then we can use JSON in projects that are working in latest Elixir or did I missed something?

@josevalim
Copy link
Member

Optional dependencies are not installed by default, which means that if we make Jason optional, all projects that depend on esbuild today but do not also explicitly depend on jason, will break unless there are on v1.18. The only way we can do this transition without breaking changes is by making Elixir v1.18 a requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants