Damian Jacobs
Damian Jacobs

Reputation: 538

Adding next.js into a component library to make use of Next.js features

I'm making a React component library that will be consumed in a Next.js project. I would like to add features of Next.js into my components.

Will simply adding Next.js as a dev dependency in the component library be enough?

Upvotes: 1

Views: 1206

Answers (1)

Gokhan Sari
Gokhan Sari

Reputation: 7944

If you are planning to publish your component as a package, you need to add next.js to peerDependencies. Doing so indicates your project depends on stuff from next.js but it is not included in your package and should be installed on the actual project itself.

For details please see here: https://classic.yarnpkg.com/en/docs/dependency-types/#toc-peerdependencies

Upvotes: 1

Related Questions