`nuxi module add` always install module as dependcies, even it should be `devDependencies`
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
Actually this is how we detect where to install the dependency: https://github.com/nuxt/cli/blob/bca75ab6490dfc444e3b6766ba5c47572622e2d3/src/commands/module/add.ts#L63
I think we can add an exception for @nuxt/eslint to force being a dev dependency anyway
Happy to open a PR for it?
Maybe try it 🥰
@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.
Actually, everything can be a devDependency in Nuxt 3 as we bundle everything for production (including the depdendencies used) :)
in general I would think modules should match nuxt rather than forcing modules to development mode. installing a module in dev mode (but nuxt in prod mode) would lead to a build failure if installing dependencies with --production. all modules will be required in the same environment as nuxt (i.e the build environment).
if anything we could support a flag to allow the user to choose (--dev).