nextui-org / nextui

🚀 Beautiful, fast and modern React UI library.
https://nextui.org
MIT License
21.65k stars 1.43k forks source link

[BUG] - No matching export for useProviderContext #2904

Closed notmedia closed 5 months ago

notmedia commented 5 months ago

NextUI Version

2.3.6

Describe the bug

On build getting an errors:

✘ [ERROR] No matching export in "../../node_modules/@nextui-org/system/dist/index.mjs" for import "useProviderContext"

    ../../node_modules/@nextui-org/calendar/dist/chunk-KHPJCHY4.mjs:13:9:
      13 │ import { useProviderContext } from "@nextui-org/system";
         ╵          ~~~~~~~~~~~~~~~~~~

✘ [ERROR] No matching export in "../../node_modules/@nextui-org/system/dist/index.mjs" for import "useProviderContext"

    ../../node_modules/@nextui-org/date-input/dist/chunk-KBJP3WFQ.mjs:7:9:
      7 │ import { useProviderContext } from "@nextui-org/system";
        ╵          ~~~~~~~~~~~~~~~~~~

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

-

Expected behavior

-

Screenshots or Videos

No response

Operating System Version

macOS

Browser

Chrome

linear[bot] commented 5 months ago

ENG-759 [BUG] - No matching export for useProviderContext

wingkwong commented 5 months ago

I couldn't reproduce the issue. Have you tried removing node_modules and reinstalling again before the build?

image
notmedia commented 5 months ago

@wingkwong Hi, yes

I'm trying to find a problem, on @nextui-org/react 2.3.4 version all going fine. On 2.3.5 I'm getting error only from date-input

notmedia commented 5 months ago

@wingkwong some strange things with my monorepo, it installs @nextui-org/system 2.0.15 for all packages

But I see in most components that uses useProviderContext package.json has peerDep on "@nextui-org/system": ">=2.0.0". This is probably incorrect because only in 2.1.2 useProviderContext appears.

For example - https://github.com/nextui-org/nextui/blob/canary/packages/components/date-input/package.json#L37

wingkwong commented 5 months ago

I can see useProviderContext has been exported here.

notmedia commented 5 months ago

I'm on the latest version

I found the problem. One app had @nextui-org/framer-transitions": "2.0.15" as a dependency. This broke all other packages.

But please take a look at v2.0.0 https://github.com/nextui-org/nextui/tree/v2.0.0/packages/core/system/src - there is no useProviderContext exported, I think you should bump peer dependency to "@nextui-org/system": ">=2.1.2" in all packages that uses this context

notmedia commented 5 months ago

These package are date-input and calendar

wingkwong commented 5 months ago

so you just cd to nextui/packages/components/calendar and run pnpm build to see the error?

notmedia commented 5 months ago

No, I have monorepo with multiple frontend apps. One of them had dependency of framer-transition that locked system package to 2.0.15.

That’s why all other nextui component packages used system 2.0.15 also.

I just removed framer-transition package form this app deps and run clean install on my monorepo. After that all nextui packages got system 1.2.1

So if system was locked to 1.2.1 in date-input and calendar components there would be no issues. Because it would be install correct package version for this components.

wingkwong commented 5 months ago

As I remember, framer-transition has been renamed to framer-utils since 2.3.0. Also @nextui-org/system needs to be >=2.1.0 for the new changes (e.g. calendar, date picker) introduced in 2.3.0. Therefore, I think you just need to bump all the versions to the latest ones. It should resolve the build issue on your application.

notmedia commented 5 months ago

Yes, we can close this issue.

Last try - look at packages peer deps for date-input and calendar. If it’s ok that required system can be 2.0.0 without useProviderContext do nothing. If not - bump minimum required version