nuxt / cli

⚡️ Nuxt Generation CLI Experience.
https://github.com/nuxt/cli/discussions/3
MIT License
270 stars 65 forks source link

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

Open gxres042 opened 2 months ago

gxres042 commented 2 months ago

🔗 Linked issue

454

❓ Type of 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.