Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies in @nrwl/next lead to an increased docker image size #12150

Closed
ckaeslin opened this issue Sep 21, 2022 · 2 comments · Fixed by #12247
Closed

Dependencies in @nrwl/next lead to an increased docker image size #12150

ckaeslin opened this issue Sep 21, 2022 · 2 comments · Fixed by #12247
Assignees
Labels
outdated scope: nextjs Issues related to NextJS support for Nx type: bug

Comments

@ckaeslin
Copy link
Contributor

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.
Screenshot 2022-09-21 at 13 58 38

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:
@AgentEnder AgentEnder added the scope: nextjs Issues related to NextJS support for Nx label Sep 23, 2022
@jaysoo jaysoo self-assigned this Sep 26, 2022
@jaysoo
Copy link
Member

jaysoo commented Sep 26, 2022

I think we need to compile out withNx function, which is the only reason why @nrwl/next is in dependencies and not devDependencies.

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: nextjs Issues related to NextJS support for Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants