Last active
February 27, 2019 16:14
-
-
Save owenstrevor/4a16f9329ad0bbb953b685054ca135cf to your computer and use it in GitHub Desktop.
Phoenix Webpack.config.js Auto-Reload (Phoenix 1.4.1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the below starts on line 9 of dev.exs, the rest of the file remains unchanged | |
# Just npm install nodemon globally with the below command, no need to add it to package.json | |
# $ npm install --global nodemon | |
# lines 13 to 16 below are what I added to get this to work | |
# lines 17 to 23 are already there with a new install (do not delete them, just add nodemon stuff before it) | |
config :my_app, MyAppWeb.Endpoint, | |
http: [port: 4000], | |
debug_errors: true, | |
code_reloader: true, | |
check_origin: false, | |
watchers: [ | |
nodemon: [ | |
"--watch", | |
"webpack.config.js", | |
"--exec", | |
"node_modules/webpack/bin/webpack.js", | |
"--mode", | |
"development", | |
"--watch-stdin", | |
cd: Path.expand("../assets", __DIR__) | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is what the top of dev.exs looks like in a new install
This is what you need to change it to for Webpack to auto-reload with the new settings after you modify config files
Just install nodemon globally and you are good to go (Phoenix 1.4.1)