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

[V3] React plugin generates warnings for arrow function components when using jsxRuntime: "classic" #8947

Closed
7 tasks done
davidwallacejackson opened this issue Jul 6, 2022 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@davidwallacejackson
Copy link
Contributor

Describe the bug

I'm defining a React component as an arrow function, e.g. const App = () => {...}.

This produces no warning in v2. In v3 beta 6, every arrow function component generates a warning along the lines of:

[vite] warning: Top-level "this" will be replaced with undefined since this file is an ECMAScript module
12 |  
13 |    const [count, setCount] = useState(0);
14 |    return <div className="App" __self={this} __source={{
   |                                        ^
15 |      fileName: _jsxFileName,
16 |      lineNumber: 10,

Reproduction

https://stackblitz.com/edit/vitejs-vite-xncvpl?file=src%2FApp.tsx,package.json,vite.config.ts,src%2Fmain.tsx,README.md&terminal=dev

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.10 - /bin/yarn
    npm: 7.17.0 - /bin/npm
  npmPackages:
    @vitejs/plugin-react: ^1.3.2 => 1.3.2 
    vite: 3.0.0-beta.6 => 3.0.0-beta.6

Used Package Manager

npm

Logs

No response

Validations

@sapphi-red
Copy link
Member

Duplicate of #8644.

This is fixed by #8674.
Please upgrade plugin-react to 2.0.0-beta.0.

@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Jul 6, 2022
@sapphi-red sapphi-red added duplicate This issue or pull request already exists and removed pending triage labels Jul 6, 2022
@davidwallacejackson
Copy link
Contributor Author

Sorry about that, @sapphi-red! Thanks for letting me know.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants