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

The issue with a publishable library in a Next.js app. The app uses the library from dist instead of libs folder #5762

Closed
lasota-piotr opened this issue May 24, 2021 · 3 comments · Fixed by #5738
Assignees
Labels
outdated scope: nextjs Issues related to NextJS support for Nx type: bug

Comments

@lasota-piotr
Copy link

lasota-piotr commented May 24, 2021

Current Behavior

Using the current version (12.3.4) of NX when I start the Next.js app in dev mode using npx nx run next-app:serve,
I got an alert:

Some of the project next-app's dependencies have not been built yet.

Please build these libraries first:
- shared-lib-publishable

Try: nx build next-app --with-deps

Screenshot 2021-05-24 at 14 31 00

After I run nx build next-app --with-deps. I can run the app locally using npx nx run next-app:serve.
When I change something in the publishable library shared-lib-publishable, the app doesn't change. I mean, I can't see this change in the app on localhost:4200.
The change shows in the app when I run nx build next-app --with-deps again, so it looks like the Next.js app uses the built version of the library, from dist folder instead of libs folder.

Expected Behavior

It should work like in version 11 of NX.
I mean, when I run npx nx run next-app:serve, it doesn't ask to build the app with deps, and I can see changes of the publishable library in the app in dev mode (npx nx run next-app:serve).
Screenshot 2021-05-24 at 14 43 37

Steps to Reproduce

Wrong behaviour:
Repo with NX 12.3.4 and Next.js App and publishable library:

  1. Clone this repo: https://github.com/lasota-piotr/nx-test-12
  2. Run npx nx run next-app:serve
  3. It should show the message Some of the project next-app's dependencies have not been built yet..
    The app doesn't react to changes in the publishable library

Correct behaviour:
Repo with NX 11.6.3 and Next.js App and publishable library:

  1. Clone this repo: https://github.com/lasota-piotr/nx-test-11
  2. Run npx nx run next-app:serve
  3. It should work correctly. The app reacts to changes in the publishable library

Failure Logs

Environment

  nx-test-12 git:(main) npx nx report            

>  NX  Report complete - copy this into the issue template

  Node : 16.0.0
  OS   : darwin x64
  npm  : 7.10.0
  
  nx : Not Found
  @nrwl/angular : Not Found
  @nrwl/cli : 12.3.4
  @nrwl/cypress : 12.3.4
  @nrwl/devkit : 12.3.4
  @nrwl/eslint-plugin-nx : 12.3.4
  @nrwl/express : Not Found
  @nrwl/jest : 12.3.4
  @nrwl/linter : 12.3.4
  @nrwl/nest : Not Found
  @nrwl/next : 12.3.4
  @nrwl/node : Not Found
  @nrwl/react : 12.3.4
  @nrwl/schematics : Not Found
  @nrwl/tao : 12.3.4
  @nrwl/web : 12.3.4
  @nrwl/workspace : 12.3.4
  @nrwl/storybook : 12.3.4
  @nrwl/gatsby : Not Found
  typescript : 4.2.4
 nx-test-11 git:(main) npx nx report            

>  NX  Report complete - copy this into the issue template

  Node : 16.0.0
  OS   : darwin x64
  npm  : 7.10.0
  
  nx : Not Found
  @nrwl/angular : Not Found
  @nrwl/cli : 11.6.3
  @nrwl/cypress : 11.6.3
  @nrwl/devkit : 11.6.3
  @nrwl/eslint-plugin-nx : 11.6.3
  @nrwl/express : Not Found
  @nrwl/jest : 11.6.3
  @nrwl/linter : 11.6.3
  @nrwl/nest : Not Found
  @nrwl/next : 11.6.3
  @nrwl/node : Not Found
  @nrwl/react : 11.6.3
  @nrwl/schematics : Not Found
  @nrwl/tao : 11.6.3
  @nrwl/web : 11.6.3
  @nrwl/workspace : 11.6.3
  @nrwl/storybook : 11.6.3
  @nrwl/gatsby : Not Found
  typescript : 4.0.7
@kirjai kirjai added the scope: nextjs Issues related to NextJS support for Nx label May 25, 2021
@kirjai
Copy link
Contributor

kirjai commented May 28, 2021

hi @lasota-piotr , thanks for opening the issue!

I believe #5738 should make this behaviour opt-in, so that you can continue using buildable libs as you were before 👍

@lasota-piotr
Copy link
Author

lasota-piotr commented May 28, 2021

Thanks so much 😉

@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 23, 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.

2 participants