nx
nx copied to clipboard
Dependencies in @nrwl/next lead to an increased docker image size
Current Behavior
At the moment @nrwl/next is needed in order to run the next application. Though the package.json has only dependencies, no devDependencies. Some of it like cypress https://github.com/nrwl/nx/blob/master/packages/next/package.json#L38 is not needed in production.
As it can be seen in the screenshot bellow the difference is over 200 MB in additional dependencies which are not needed.

Expected Behavior
@nrwl/next has libraries which are not needed for production run (like cypress, jest and others) as devDependencies and therefore they are not installed in a production build.
Steps to Reproduce
Create a simple new nx next app. Dockerize it with the following docker file.
FROM node:16-alpine
ENV NODE_ENV=production
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install --omit=dev --prefer-offline --no-audit --ignore-scripts
npm install --omit=dev installs cypress and various other libraries in the docker image although it is not needed in production.
Environment
Node : 16.17.0
OS : darwin arm64
npm : 8.15.0
nx : 14.7.8
@nrwl/angular : Not Found
@nrwl/cypress : 14.7.8
@nrwl/detox : Not Found
@nrwl/devkit : 14.7.8
@nrwl/eslint-plugin-nx : 14.7.8
@nrwl/expo : Not Found
@nrwl/express : Not Found
@nrwl/jest : 14.7.8
@nrwl/js : 14.7.8
@nrwl/linter : 14.7.8
@nrwl/nest : Not Found
@nrwl/next : 14.7.8
@nrwl/node : Not Found
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : 14.7.8
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : 14.7.8
@nrwl/web : 14.7.8
@nrwl/workspace : 14.7.8
typescript : 4.8.3
---------------------------------------
Local workspace plugins:
---------------------------------------
Community plugins: