Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev mode error: "originalFactory is undefined" when importing client component ("use client") from other package #43902

Closed
1 task done
reiv opened this issue Dec 9, 2022 · 4 comments · Fixed by #44011
Closed
1 task done
Assignees
Labels
kind: bug Confirmed bug that is on the backlog

Comments

@reiv
Copy link

reiv commented Dec 9, 2022

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information


    Operating System:
      Platform: win32
      Arch: x64
      Version: Windows 10 Pro
    Binaries:
      Node: 19.0.0
      npm: N/A
      Yarn: N/A
      pnpm: N/A
    Relevant packages:
      next: 13.0.7-canary.4
      eslint-config-next: 13.0.0
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true)

Link to the code that reproduces this issue

Repro here: https://github.com/reiv/next-canary-test

To Reproduce

  • clone the repro
  • install deps
  • run next dev in the apps/web
  • observe error immediately after page loads

Describe the Bug

(The repro is based on the turborepo starter, modified to use appDir: true as well as the latest canary.)

Importing a React client component from a module outside of the Next app causes TypeError: originalFactory is undefined. This only occurs in dev mode, and seems to be limited to client components ("use client") - non-client components can be imported without error.

The bug exists as of 13.0.7-canary.3 (13.0.7-canary.1 works fine).

Expected Behavior

No error in dev mode.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@reiv reiv added the bug Issue was opened via the bug report template. label Dec 9, 2022
@reiv reiv changed the title Dev mode error: "originalFactory is undefined" when importing client componen ("use client") from other package Dev mode error: "originalFactory is undefined" when importing client component ("use client") from other package Dec 9, 2022
@nordowl
Copy link

nordowl commented Dec 10, 2022

I have the same error running this repo in dev https://github.com/vercel/app-playground

@reiv
Copy link
Author

reiv commented Dec 13, 2022

Possibly a Windows-only bug, just tested on a different machine with no issues.

    Operating System:
      Platform: linux
      Arch: x64
      Version: #78-Ubuntu SMP Fri Mar 19 13:29:52 UTC 2021
    Binaries:
      Node: 19.2.0
      npm: 8.19.3
      Yarn: 1.22.19
      pnpm: 7.18.2
    Relevant packages:
      next: 13.0.7-canary.4
      eslint-config-next: 13.0.3
      react: 18.2.0
      react-dom: 18.2.0

What about you @Fluxium2006 ?

@huozhi huozhi added kind: bug Confirmed bug that is on the backlog and removed bug Issue was opened via the bug report template. labels Dec 13, 2022
@rafma0
Copy link

rafma0 commented Dec 13, 2022

Looks the same as #43854 , the bug is still present in canary.6 on Windows

@huozhi huozhi self-assigned this Dec 14, 2022
huozhi added a commit that referenced this issue Dec 14, 2022
## Bug

The app client entry key was in win32 slashes like `app\blog`, and when
we add the new layer checking logic in #43197, `name.startsWith('app/')`
doesn't work.

Fixes #43854
Fixes #43902

<img width="862" alt="image"
src="https://user-images.githubusercontent.com/4800338/207641886-08ffc159-0516-4609-9a1f-8c8693586122.png">


- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: bug Confirmed bug that is on the backlog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants