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

[Bug]: Extension doesn't work when nuxt project is in a sub folder of the workspace #49

Open
MartinTruRating opened this issue Sep 21, 2023 · 12 comments
Labels
bug Something isn't working

Comments

@MartinTruRating
Copy link

Environment

Nuxt project info:



What went wrong?

I was trying to use nuxtr when my nuxt project lives within a subfolder within the workspace (ie /src). But it cannot find it (see below

image

Is there a config setting that allows it to set the root dir of nuxtr so it can then pick everything up and work?

I tried using the monorepo DirectoryName config setting set to /src which enabled the extension and worked for things like creating components/stores etc but didn't for installing deps because it was trying to use the workspace root which is correct for a monorepo setup.

How to reproduce it?

Install nuxt into a subfolder structure like this:
image

Nuxtr isn't available in the sidebar or command pallete

@MartinTruRating MartinTruRating added the bug Something isn't working label Sep 21, 2023
@adhamfarrag
Copy link
Member

Hello @MartinTruRating,

To be clear, your issue now is not being able to install dependencies ?
Also, /src dir has your whole Nuxt logic ?

@0vn
Copy link

0vn commented Sep 22, 2023

I encountered the same problem, when Workspace mode is enabled, Nuxtr recognizes the first item in the workspace by default, and when my project is not ranked first in the workspace, Nuxtr does not recognize the item I need, and currently I can only fix this problem when I move my project to the first place

@adhamfarrag
Copy link
Member

@Administrator-M can you elaborate more about "my project is not ranked first in the workspace" ?

@MartinTruRating
Copy link
Author

@adhamfarrag Hello, yeah so the /src has everything in it from .nuxt folder to node_modules folder etc. But because the vscode editor is opened at the parent level above /src it would try to install packages at that level (if I enabled workspace mode).

It's like we need a combination of the two in a setting where you can specifiy the rootDir or something for where nuxtr starts working from

@adhamfarrag
Copy link
Member

adhamfarrag commented Sep 28, 2023

@MartinTruRating have you tried using "nuxtr.monorepoMode.DirectoryName": "src" ?

@MartinTruRating
Copy link
Author

MartinTruRating commented Oct 2, 2023

@adhamfarrag I did, so that then worked (as in I could use it to create components etc), but the problem then was when I tried to install/update any dependencies, it tried doing it in the folder above the src folder (which in a monorepo setup would be fine as the modules get installed into the root) rather than within the /src folder.

I've added the following rough directory structure if this helps at all

$root
 - .vscode
 - other root files
 - src (where the main app lives)
 - - .nuxt
 - - components
 - - composables
 - - node_modules

@adhamfarrag
Copy link
Member

Got it.. I will refactor monorepo features and release it as soon as I can.

@MartinTruRating
Copy link
Author

Brilliant, thank you very much! Make sure you still keep the monorepo functionality/compatibility for those that want to use that feature as I've used it on different projects :)

@adarsh4d
Copy link

@adhamfarrag Thanks for your awesome work on this!

To add more info regarding the issue faced by @Administrator-M, when we create Multi-root Workspaces if the first folder has a different project, then all the features provided by Nuxtr are not available.

For example, if the multi-root workspace is like this, it works
image

However, this doesn't work
image

The reason for using this approach is both has different language/framework and have their own source control. They are just grouped using the multi-root workspace approach to avoid switching windows.

@RihanArfan
Copy link

RihanArfan commented Oct 22, 2023

Experiencing the same issue. Here's my project structure:

├───apps
│   ├───application1
│   └───application2
└───packages
    └───base

@XStarlink
Copy link

Experiencing the same issue. Here's my project structure:

├───apps
│   ├───application1
│   └───application2
└───packages
    └───base

I have the same structure, and I'd love to use Nuxtr with the file creation templates it offers, but in my monorepo it won't activate...

@aqz236
Copy link

aqz236 commented Dec 8, 2024


I ran into the same issue with my monorepo, but I’ve already fixed it. Here’s how I did it:


📦 monorepo-main
┣ 📂 apps
┃ ┣ 📂 nuxt
┃ ┃ ┣ 📜 nuxt.config.ts // Nuxt config file
┃ ┃ ┣ 📜 pnpm-lock.yaml // This is an empty file, used to trick Nuxt into thinking it's using pnpm
┃ ┃ ┗ 📜 package.json // Nuxt package.json
┃ ┗ 📂 other
┗ 📜 package.json // monorepo-main package.json
┗ 📜 pnpm-lock.yaml // monorepo-main pnpm-lock.yaml


Hope that helps! Let me know if you need more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants