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

nuxi module add always install module as dependcies, even it should be devDependencies #454

Open
gxres042 opened this issue Jul 30, 2024 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@gxres042
Copy link

For example, when I install @nuxt/eslint, for pnpm, I will install eslint and @nuxt/eslint as devDepencies:

pnpm add -D @nuxt/eslint eslint

But when I use nuxi module add eslint, it runs:

pnpm add @nuxt/eslint // didn't have eslint
@atinux
Copy link
Member

atinux commented Jul 31, 2024

Actually this is how we detect where to install the dependency:

const isDev = Boolean(projectPkg.devDependencies?.nuxt)

I think we can add an exception for @nuxt/eslint to force being a dev dependency anyway

Happy to open a PR for it?

@atinux atinux added enhancement New feature or request good first issue Good for newcomers labels Jul 31, 2024
@gxres042
Copy link
Author

gxres042 commented Aug 1, 2024

Maybe try it 🥰

@gxres042
Copy link
Author

gxres042 commented Aug 1, 2024

@atinux I found a question

When initializing a Nuxt 3 project, nuxt and vue are installed by default as dependencies instead of devDependencies. The detection above is done by checking if nuxt is a devDependency, i.e. if nuxt in the user's project is not a devDependency, then any dependencies added by the user's module add will not be installed as devDependencies.

I'm not quite sure if all the official Nuxt modules need to be installed as devDependencies, but what I do know so far is that the manual install of @nuxt/eslint requires it and eslint to be installed as devDependencies.

@atinux
Copy link
Member

atinux commented Aug 12, 2024

Actually, everything can be a devDependency in Nuxt 3 as we bundle everything for production (including the depdendencies used) :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants