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

node v20+ esm module resolution / types not working properly #90

Open
tom2strobl opened this issue Oct 2, 2024 · 0 comments
Open

node v20+ esm module resolution / types not working properly #90

tom2strobl opened this issue Oct 2, 2024 · 0 comments

Comments

@tom2strobl
Copy link

Environments

  • Framework name: react
  • Framework version: 18
  • Component name: @scena/react-guides
  • Component version: 0.28.2

Description

Hi there! I'm using node v20+ ESM with type: "module" and typescript with "moduleResolution": "NodeNext" in tsconfig.json.

import Guides from '@scena/react-guides'

function Component() {
  return <Guides />
}

In VSCode <Guides> is underlined with the following:
JSX element type 'Guides' does not have any construct or call signatures.ts(2604)

I also tried the following things without success:

// same issue
import { default as Guides } from '@scena/react-guides'

// not available
import { Guides } from '@scena/react-guides'

// obviously breaks the types
import Guides from '@scena/react-guides/dist/guides.esm.js'
import Guides from '@scena/react-guides/src/index.esm.js'

I think moveable and your other repos are suffering from the same issue.

Here's a minimal reproduction repository:
https://github.com/tom2strobl/daybrush-node-esm

Maybe it's as simple as adding an "exports" field to the package.json? I'm not sure if the module property is still the way to go
"module": "./dist/guides.esm.js", -> "exports": { "./": "./dist/guides.esm.js" }"

Let me know if I can help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant