Skip to content

Problems witn next 15.3 and internal libs #30714

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

Open
1 of 4 tasks
gperdomor opened this issue Apr 14, 2025 · 3 comments
Open
1 of 4 tasks

Problems witn next 15.3 and internal libs #30714

gperdomor opened this issue Apr 14, 2025 · 3 comments
Assignees
Labels
priority: medium Medium Priority (not high, not low priority) scope: nextjs Issues related to NextJS support for Nx type: bug

Comments

@gperdomor
Copy link
Contributor

Current Behavior

You can't use internal workspace libs in your next apps... The packages are not resolved

Expected Behavior

The apps should works as expected...

GitHub Repo

https://github.com/gperdomor/nx-next-issue

Steps to Reproduce

  1. Create an empty workspace
  2. Create a sample js library
  3. Create a next app
  4. Use the library inside your next app
  5. Run the app and open a page... Is working as expected
  6. Update next to latest 15.3.0 version (also in package.json from the app folder)
  7. Run the app again and open a page... Make sure that runs with next 15.3.0, if not please remove .next folder and node_modules inside your app folder.
  8. You will get something like this:
Image

Nx Report

nx report

 NX   Report complete - copy this into the issue template

Node           : 22.14.0
OS             : darwin-x64
Native Target  : x86_64-macos
npm            : 11.3.0

nx (global)            : 20.8.0
nx                     : 20.8.0
@nx/js                 : 20.8.0
@nx/eslint             : 20.8.0
@nx/workspace          : 20.8.0
@nx/devkit             : 20.8.0
@nx/eslint-plugin      : 20.8.0
@nx/module-federation  : 20.8.0
@nx/next               : 20.8.0
@nx/react              : 20.8.0
@nx/vite               : 20.8.0
@nx/web                : 20.8.0
@nx/webpack            : 20.8.0
typescript             : 5.7.3
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/vite/plugin
@nx/eslint/plugin
@nx/next/plugin
---------------------------------------
Cache Usage: 0.00 B / 93.15 GB

Failure Logs

nx run website:dev --turbo

> next dev --turbo

   ▲ Next.js 15.3.0 (Turbopack)
   - Local:        http://localhost:3000
   - Network:      http://192.168.1.93:3000

 ✓ Starting...
 ✓ Ready in 2s
 ○ Compiling / ...
 ✓ Compiled / in 1082ms
 ⨯ ./packages/sample-lib/src/index.ts:1:1
Module not found: Can't resolve './lib/sample-lib.js'
> 1 | export * from './lib/sample-lib.js';
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2 |



https://nextjs.org/docs/messages/module-not-found



./apps/website/src/app/page.tsx:1:1
Export sampleLib doesn't exist in target module
> 1 | import { sampleLib } from '@sandbox/sample-lib';
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2 | import styles from './page.module.css';
  3 |
  4 | export default function Index() {

The export sampleLib was not found in module [project]/packages/sample-lib/src/index.ts [app-rsc] (ecmascript) <exports>.
The module has no exports at all.
All exports of the module are statically known (It doesn't have dynamic exports). So it's known statically that the requested export doesn't exist.


 ○ Compiling /_error ...
 ✓ Compiled /_error in 1073ms
 GET / 500 in 2421ms

n^C

—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Successfully ran target dev for project website

Package Manager Version

npm 11.3.0

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@FrozenPandaz FrozenPandaz added scope: nextjs Issues related to NextJS support for Nx priority: medium Medium Priority (not high, not low priority) labels Apr 14, 2025
@ianldgs
Copy link
Contributor

ianldgs commented Apr 15, 2025

Out of curiosity: have you tried rspack?

https://github.com/vercel/next.js/blob/canary/examples/with-rspack/next.config.js

@mj-meyer
Copy link

can confirm, I'm running into the same issue

@gperdomor
Copy link
Contributor Author

Any update or workaround for this? 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium Medium Priority (not high, not low priority) scope: nextjs Issues related to NextJS support for Nx type: bug
Projects
None yet
Development

No branches or pull requests

5 participants