1
votes

I have a phoenix application, however I have needed to restart the server manually after every backend change. code_reload is enabled, and plug CodeReload is being used.

I've tried generating a new project (mix phoenix.new --no-brunch), I've tried different editors (vim, vscode, atom, and textedit), I've tried always requiring plug CodeReload in my endpoint, and I've tried manually setting the MIX_ENV to dev - however my project still won't compile when I change a file. How should I go about tracking down what the problem is?

CodeReload does not work when running mix phoenix.server or iex -S mix phoenix.server

1
Which file are you changing? - Dogbert
Check your config for live_reload settings like here: see ## Configuration. You may have to configure which file changes will trigger a live reload. - guitarman
@Dogbert models, controllers, routers - really any backend files. - cadlac
@guitarman live_reload is only for static assets, correct? I'm writing an API with phoenix, the front end is in another repository. Even so I've tried adding new directories to the live_reload setting, and that did not work either. - cadlac
@cadlac: It's not only for static assets. I added my gettext *.po translation files for example. If you add another row in the patterns list, you need to add a regex for the files you want to watch, not only directories. - guitarman

1 Answers

8
votes

I was running into the same problem. In my case it was caused by a VS Code plugin (https://github.com/iampeterbanjo/vscode-elixir-linter). Disabling the plugin made the code reloading work again.