8000 TypeError: Cannot read properties of undefined ('configs') when importing eslint-plugin-react-compiler · Issue #376 · unjs/jiti · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

TypeError: Cannot read properties of undefined ('configs') when importing eslint-plugin-react-compiler #376

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 8000 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

Open
sethamus opened this issue May 4, 2025 · 4 comments · May be fixed by #377
Labels
bug Something isn't working

Comments

@sethamus
Copy link
sethamus commented May 4, 2025

Environment

jiti version: 2.4.2
eslint-plugin-react-compiler version:19.1.0-rc.1

Describe the bug

I've encountered a TypeError when trying to access the configs property of eslint-plugin-react-compiler when running a simple script with jiti. The same code works without issue when executed with Node.js.

Reproduction

  1. Create a file named index.ts.
  2. Populate index.ts with the following code:
import reactCompiler from "eslint-plugin-react-compiler"

console.log(reactCompiler.configs.recommended)
  1. Run the script using jiti:
npx jiti ./index.ts

Expected Behavior

The script should successfully import eslint-plugin-react-compiler and log the recommended configuration object to the console, similar to how it behaves when run with Node.js.

Actual Behavior

Running the script with jiti results in the following error:

TypeError: Cannot read properties of undefined (reading 'configs')
@sethamus sethamus added the bug Something isn't working label May 4, 2025
@kricsleo
Copy link
Member
kricsleo commented May 4, 2025

eslint-plugin-react-compiler has no default export:
https://github.com/facebook/react/blob/main/compiler/packages/eslint-plugin-react-compiler/src/index.ts#L33

You should use a namespace import like this:

import * as reactCompiler from "eslint-plugin-react-compiler"

console.log(reactCompiler.configs.recommended)

Uh oh!

There was an error while loading. Please reload this page.

@sethamus
Copy link
Author
sethamus commented May 4, 2025

It works with node though?

@kricsleo
Copy link
Member
kricsleo commented May 4, 2025

May I ask what your package.json's "type" config is? 🙏

@sethamus
Copy link
Author
sethamus commented May 4, 2025

module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0