Skip to content

Add "tailwindcss@next" to the "peerDependencies" section in the package.json file. #3349

@suiyueou

Description

@suiyueou

Description

Before using nuxt ui, I briefly skimmed through the repository and found an already closed issue: 3018

The error and solution mentioned in this issue (the v2 documentation indeed did not mention the solution) can actually be resolved by adding tailwindcss@next to the peerDependencies section in the package.json file.

This is because when nuxi module add installs a module, it not only installs the module itself but also scans the module package's peerDependencies.

For example, when using nuxi module add pinia, since @pinia/nuxt has pinia listed in its peerDependencies in the package.json, both @pinia/nuxt and pinia will be automatically installed during the module installation.

If there are dependencies in peerDependencies that you do not want nuxi module to install automatically, you can use peerDependenciesMeta to ignore them, for example:

"peerDependenciesMeta": {
    "pinia": {
      "optional": true
    }
  },

Therefore, Nuxt UI can specify tailwindcss@next in the peerDependencies of package.json, ensuring Tailwind CSS is automatically installed when the Nuxt UI module is installed.

This solution applies to both v3 and v2.

PS: I noticed typescript in the peerDependencies of the v3 package.json. Is this a necessary dependency similar to tailwindcss? If not, after adding tailwindcss, perhaps peerDependenciesMeta could be used to ignore it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requestedv3#1289

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions