If you just want to copy-paste this it should "just work", but you'll need to get yarn
set up. Follow the instructions at https://yarnpkg.com/getting-started/install OR just run:
npm install -g yarn
yarn set version berry
yarn install
# this should make a.yarn/
,yarn.lock
, and.pnp.js
If you want to run these outside of the context of a running phoenix server, you can also run the mix tasks, mix assets.install
and mix assets.compile
. They are a copy paste of some the CLI bits but you could abstract them out to point to a config/cmds.exs
or something if you wanted.
I am not using downloadable binary because I needed the ability to run plugins, which relies on node. If you don't need to run plugins, you can just use the binary, or check out https://github.com/phoenixframework/esbuild
Also until evanw/esbuild#1449 is reviewed and/or merged, the watch.js
file will require chokidar
to handle the loss of stdin while running the server.
postcss-cli does not yet pass through dir-dependency
messages to its plugins.
postcss/postcss-cli#383 has been merged which should fix that, but as of writing it has not yet been released in a new version.
This uses yarn
but there's no reason it wouldn't work just fine with node and npm, I just prefer yarn
's consistency and Zero-Install approach. If you wanted to use npm
there's a lot of things from this that could be removed, but it's mostly a matter of removing references to .pnp.js
and yarn_path
from the config/dev.exs
and replacing them with npx
and the like.
I suggest running pgrep -l "node|esbuild"
before, during, and after running the server to confirm how many processes are running. If something is still running, it means something isn't right, and your processes are hanging around when they shouldn't. This isn't an issue with Phoenix or Elixir. It's an issue with how signals and interrupts are handled and propogated to children throughout different Unix-like systems. There is not a clear "right way" that has been adopted, especially within the CLI tools of many different languages.
If you do have zombie processes, you can run pkill -l "node|esbuild"