Next.js Discord

Discord Forum

Monorepo with `optimizePackageImports` and multiple versions of the same package

Unanswered
Atlantic menhaden posted this in #help-forum
Open in Discord
Atlantic menhadenOP
Hi,

I have a monorepo with 2 versions of Next.js websites and some dependencies that have different versions, such as @chakra-ui/react. It seems optimizePackageImports is not using the correct package version for that package.

Here is a breakdown:
| nextjs-14
-> @chakra-ui/react v2
| nextjs-15
-> @chakra-ui/react v3

When using the dev command (non-turbo + optimizePackageImports including @chakra-ui/react) the nextjs-15 version will reference the @chakra-ui/react v2 instead of @chakra-ui/react v3.

I've tried the canary version, any one know of any other workarounds?

1 Reply

Atlantic menhadenOP
To clarify this is only when using optimizePackageImports.