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

feat(module): Force new dependencies to be devDependencies (if it's in a specific list) #463

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

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.

@@ -15,6 +15,12 @@ import {
} 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
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