I’m struggling a bit with Phoenix and assets.
I have added a dependancy from npm (installed it in the assets-folder according to the docs).
It works fine for development, but I’m having problems with deployments/production.
I use the generated Dockerfile, but when it tries to build it can’t find the npm-package (npm install has not been runned).
What I find a bit lacking in the docs is if I’m supposed to handle this myself? Or should the esbuild task handle this?
(E.g. do I need to add a buildstep in the Dockerfile where I use node to install the package?)
That’s the case. The phoenix boilerplate does use neither node nor npm. So if you want to use those you need to add them to all the necessary places including the docker setup.
And be sure to use the same OS for Node and Elixir (deb/deb).
I was curious if anyone had problems with building the dependencies. Npm didn’t accept the link in the package.json? It was fine however with pnpm (I don’t use yarn).
Ah, yes, I forgot I had to build a custom Esbuild (nicely documented in the doc) as we embed a SolidJS iframe that communicates via websockets/channel.
This seems to work (at least for my current project/setup).
I also feel that this perhaps should be a part of the generator? Like if it detects a package.json in the assets folder it adds an install step to the Dockerfile.