Issue has been resolved by creating an alias for the lib in the nuxt config. See nrwl/nx#22410 (comment)
This project is a demo to reproduce an issue with the @nx/nuxt plugin (see).
I used the defaults for all prompts when creating the Nx workspace and the lib.
- Create a new Nx workspace with the following command:
npx create-nx-workspace@latest nx-nuxt-demo --preset=nuxt
- Create a plain typescript lib with:
npx nx g lib
- Install packages with
npm install
- Run the app with
npx nx serve nx-nuxt-demo
ornpm run serve
- Import the lib in the nuxt server part: e.g. apps/nx-nuxt-demo/src/server/api/greet.ts
- The following error occurs in the console:
ERROR [worker reload] [worker init] Cannot find package '@nx-nuxt-demo/demo' imported from /home/lmoesle/source/playground/nx-nuxt-demo/apps/nx-nuxt-demo/.nuxt/dev/index.mjs