Hi slightly_smiling_fac…

1 minute read

Hi :slightly_smiling_face: all

I started using nx for 4 weeks now, and i’m having some issues with peer depedencies. What i have is all publisable libs like i have a UI and Mixins library and my UI library uses the Mixins library i assume that it is a peer depedencies then because i’m also using the mixins in the nextjs app i created. But by default all those depedencies when building it appears in package.json under depedencies. So i modified the package.json of the libraries and put all the peerDepedencies in there seems that is working but some appears double now like in depedencies and peerDepedencies. So that my first question how should peer depedencies work in NX?

My Second question is that i build the nextjs app and want to put it in a docker image the only two depedencies in the package.json of my nextjs app are next, react, read-dom while my app uses styled-components. so what i do i put dist/nextjs into a docker image run npm i and then npm run start and then i got the message that styled-components cannot be found (duh) because it is not in the package.json but why it isn’t?

Responses:

Regarding your second question: this is actually a bug with the nextjs build output right now, it’s basically not usable as is :pensive:.

The way I’ve temporarily solved this is manually copying the root package.json and replacing the one in the dist folder before deploy/trying to start the app.

Is there a ticket for? then i can track it :slightly_smiling_face: when it is fixed ^^

https://github.com/nrwl/nx/issues/3062 if you like to use Vercel then this one might be useful as well https://github.com/nrwl/nx/issues/3051

Updated: