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

Turbopack incorrectly resolves imported functions when wrapping into private method calls #75938

Closed
kossnocorp opened this issue Feb 12, 2025 · 1 comment · Fixed by #76654
Closed
Assignees
Labels
linear: turbopack Confirmed issue that is tracked by the Turbopack team. Turbopack Related to Turbopack with Next.js.

Comments

@kossnocorp
Copy link

Link to the code that reproduces this issue

https://github.com/kossnocorp/turbopack-private-bug

To Reproduce

  1. Set up and run the app:
git clone git@github.com:kossnocorp/turbopack-private-bug.git
cd turbopack-private-bug
pnpm install
pnpm run dev # pnpm exec next dev --turbo
  1. Open the app in a browser and click the "Click me" button.

Current vs. Expected behavior

It should correctly resolve fooBar function and not to throw an error:

Uncaught ReferenceError: fooBar is not defined
    at page.tsx:15:7
    at #wrap (page.tsx:20:12)
    at HelloWorld.hi (page.tsx:14:15)
    at onClick (page.tsx:9:44)

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
  Available memory (MB): 30862
  Available CPU cores: 32
Binaries:
  Node: 22.13.1
  npm: 10.9.2
  Yarn: N/A
  pnpm: 9.15.4
Relevant Packages:
  next: 15.2.0-canary.53 // Latest available version is detected (15.2.0-canary.53).
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

No response

@github-actions github-actions bot added the Turbopack Related to Turbopack with Next.js. label Feb 12, 2025
@mischnic mischnic added the linear: turbopack Confirmed issue that is tracked by the Turbopack team. label Feb 12, 2025
@kdy1 kdy1 self-assigned this Feb 14, 2025
kdy1 added a commit that referenced this issue Mar 3, 2025
### What?

Still look for effects even if a private property exists.

### Why?

It's valid ECMAScript input.

### How?

Closes #75938
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear: turbopack Confirmed issue that is tracked by the Turbopack team. Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants