Reputation: 49
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
Upvotes: 1
Views: 1630
Reputation: 1734
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.
Upvotes: 5
Reputation: 121000
No, you don’t need any extension, brunch
does this out of the box. Make sure you did not use --no-brunch
option while generating the project scaffold, make sure you have assets compiled as shown here and make sure you have watch
option enabled in your assets/package.json
:
{
"repository": {},
"license": "MIT",
"scripts": {
"deploy": "brunch build --production",
"watch": "brunch watch --stdin"
},
"dependencies": {
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html"
},
"devDependencies": {
"babel-brunch": "6.1.1",
"brunch": "2.10.9",
"clean-css-brunch": "2.10.0",
"uglify-js-brunch": "2.10.0"
}
}
Upvotes: 1