How to run mix format from a mix release?

I am trying to run mix format inside my code and using elixir-ls code as a reference:

I created a new project, added :mix to extra_applications to be able to to use mix in a release. The problem is when I try to format a file in a phoenix project using phoenix plugin, it will said that plugin Phoenix.LiveView.HTMLFormatter was not loaded. I was able to solve this issue by loading all the beam file in the project that I want to format to my release code at runtime. But the .formatter.exs in a phoenix project also have an import_deps section, the mix format also checked for deps, but my release code do not have these deps and I could not find a way to solve this issue.

How can I correctly use mix format inside elixir code like elixir-ls?

Actually, any suggestion for what I am trying to do are welcome, I am trying to build a formatting service back end for my vscode extension, I could use mix format directly, but the vm spin up time make it took more than 1 second to format a simple file, so I thought running a back end upfront may help reduce the time.