nx
nx copied to clipboard
@nx/nuxt: unable to use library packages in nuxt.config.ts file
Current Behavior
Can't use library packages inside nuxt application nuxt.config.ts file, however can use files in src/** (but getting TS type error from https://github.com/nrwl/nx/issues/21862)
Expected Behavior
Can use library packages in any file of nuxt application
GitHub Repo
No response
Steps to Reproduce
Reproduction - https://github.com/Renhor/nx-nuxt-2307
Nx Report
Node : 18.17.1
OS : darwin-arm64
npm : 9.6.7
nx : 18.0.4
@nx/js : 18.0.4
@nx/linter : 18.0.4
@nx/eslint : 18.0.4
@nx/workspace : 18.0.4
@nx/devkit : 18.0.4
@nx/eslint-plugin : 18.0.4
@nrwl/tao : 18.0.4
@nx/vite : 18.0.4
@nx/vue : 18.0.4
@nx/web : 18.0.4
typescript : 5.3.3
---------------------------------------
Community plugins:
@nx/nuxt : 18.0.4
Failure Logs
➜ org git:(main) npx nx serve org
> NX Unable to create nodes for apps/org/nuxt.config.ts using plugin @nx/nuxt/plugin.
Inner Error: Error: Cannot find module '@org/my-lib'
Require stack:
- /Users/romantonkoshkurov/Desktop/projects/PublicGit/org/apps/org/nuxt.config.ts
at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
at Function.resolve (node:internal/modules/cjs/helpers:127:19)
at _resolve (/Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/jiti/dist/jiti.js:1:251148)
at jiti (/Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/jiti/dist/jiti.js:1:253746)
at /Users/romantonkoshkurov/Desktop/projects/PublicGit/org/apps/org/nuxt.config.ts:2:14
at evalModule (/Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/jiti/dist/jiti.js:1:256443)
at Object.jiti (/Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/jiti/dist/jiti.js:1:254371)
at resolveConfig (file:///Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/c12/dist/index.mjs:327:26)
at loadConfig (file:///Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/c12/dist/index.mjs:128:40)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async loadNuxtConfig (file:///Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/@nuxt/kit/dist/index.mjs:2516:18)
at async getInfoFromNuxtConfig (/Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/@nx/nuxt/src/plugins/plugin.js:91:20)
at async buildNuxtTargets (/Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/@nx/nuxt/src/plugins/plugin.js:55:24)
at async exports.createNodes (/Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/@nx/nuxt/src/plugins/plugin.js:42:15)
at async Promise.all (index 0)
at async Promise.all (index 1)
at async createProjectConfigurations (/Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js:89:62)
at async processFilesAndCreateAndSerializeProjectGraph (/Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/nx/src/daemon/server/project-graph-incremental-recomputation.js:140:28)
at async getCachedSerializedProjectGraphPromise (/Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/nx/src/daemon/server/project-graph-incremental-recomputation.js:43:16)
at async handleRequestProjectGraph (/Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/nx/src/daemon/server/handle-request-project-graph.js:12:24)
at async handleResult (/Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/nx/src/daemon/server/server.js:110:16)
at async handleMessage (/Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/nx/src/daemon/server/server.js:81:9)
at async /Users/romantonkoshkurov/Desktop/projects/PublicGit/org/node_modules/nx/src/daemon/server/server.js:45:9
Because of the error the Nx daemon process has exited. The next Nx command is going to restart the daemon process.
If the error persists, please run "nx reset".
Package Manager Version
No response
Operating System
- [X] macOS
- [ ] Linux
- [ ] Windows
- [ ] Other (Please specify)
Additional Information
No response