Skip to content

Conversation

@gxres042
Copy link

πŸ”— Linked issue

#454

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR makes some changes to the module add directive: it detects a specific list of npm dependencies when adding them, and if the npm dependency to be installed is in that list, it will be installed as a development dependency.

While Nuxt will extract what is needed into the final build product, dependencies like @nuxt/eslint should not be installed as β€œdependencies” but as β€œdevDependencies” in the original meaning of dependencies and devDependencies. Hence the PR.

It's not a good practice to write a dead list inside the module add function, but I haven't come up with a perfect way to do it at this stage either.

} from './_utils'
import type { NuxtModule } from './_utils'

// Maybe we can import the list from somewhere, but idk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in general I would think modules should match nuxt rather than forcing modules to development mode. they 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).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(we could also add this list to the module registry meta btw)

@danielroe danielroe marked this pull request as draft October 22, 2024 12:40
@danielroe
Copy link
Member

I think we can mark this implemented in #630.

@danielroe danielroe closed this Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants