Next.js Discord

Discord Forum

React to changes in a "local" package

Unanswered
American black bear posted this in #help-forum
Open in Discord
American black bearOP
In a project using Next.js 13, we have a dependency to another package (currently added through ssh://git... in package.json) containing presentational components based on React, Tailwind and some other components like Headless UI. This package exports all its components in its root index.js.
In the Next.js project, we currently use the dist of this local package for importing the components. Yet it is very cumbersome to always rebuild the dist and update it in the Next.js project.
I'm looking for a solution that makes the Next dev server watch for changes in the package and then "makes them available" instantly. I thought that "transpilePackages" could have something to do with it, however I don't really understand the requirements and how it would actually work.
It would be no problem to copy the code of the separate repo to the actual Next project if that helps. Maybe just the right keywords would help me finding resources on how to achieve this.
Thanks a lot for your help.

0 Replies