Search code examples
elixirphoenix-frameworkelixir-mix

How can config to recompile in phoenix


I'm using phoenix to create a server and using editor VSCode.

When I start server: mix phx.server and I have code change, it doesn't recompile, I must turn off and run again.

Should have extension or config set somewhere that can recompile automatically?

file dev.exs

config :jwtuser, Jwtuser.Endpoint,
  http: [port: 5000],
  debug_errors: true,
  code_reloader: true,
  check_origin: false,
  watchers: [node: ["node_modules/brunch/bin/brunch", "watch", "--stdin",
                    cd: Path.expand("../assets", __DIR__)]]

in mix.exs

def project do
    [
      app: :jwtuser,
      version: "0.0.1",
      elixir: "~> 1.4",
      elixirc_paths: elixirc_paths(Mix.env),
      compilers: [:phoenix, :gettext] ++ Mix.compilers,
      start_permanent: Mix.env == :prod,
      aliases: aliases(),
      deps: deps(),
      erlc_options: erlc_options()
    ]
  end

Solution

  • If you want to see your changes while developing, you can start your server in an IEx session with:

    iex -S mix phx.server
    

    And then use

    IEx.Helpers.recompile
    

    To recompile your code.