For the conditions that nuxt app is not in the root of workspace/repository directory, often issues happen. Currently, we have an internal modulesDir option that helps to resolve this by creating a list of directories looking for node_modules (and by default process.cwd() is added to this list) but it is neither explicit or solving all cases.
Related issues:
Vite tries to find root by looking up for pnpm-workspace.yaml or a package.json with workspaces key but it is not enough since there are conditions user is not using a monorepo workspace but simply have nuxt app in a sub-directory. (https://vitejs.dev/config/#server-fsserve-root)
We can implement this by looking up (from rootDir) for first package.lock, package-lock.json or package.json that has workspaces key (unless there is a package.json in rootDir?) and falling back to rootDir if couldn't find. and also giving users ability to customize it with a nuxt option.
For the conditions that nuxt app is not in the root of workspace/repository directory, often issues happen. Currently, we have an internal
modulesDiroption that helps to resolve this by creating a list of directories looking fornode_modules(and by default process.cwd() is added to this list) but it is neither explicit or solving all cases.Related issues:
Vite tries to find root by looking up for
pnpm-workspace.yamlor apackage.jsonwithworkspaceskey but it is not enough since there are conditions user is not using a monorepo workspace but simply have nuxt app in a sub-directory. (https://vitejs.dev/config/#server-fsserve-root)We can implement this by looking up (from
rootDir) for firstpackage.lock,package-lock.jsonorpackage.jsonthat hasworkspaceskey (unless there is apackage.jsoninrootDir?) and falling back torootDirif couldn't find. and also giving users ability to customize it with a nuxt option.