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

Unable to import default exports with ESM #427

Open
3 of 5 tasks
teddybee opened this issue Dec 1, 2023 · 5 comments
Open
3 of 5 tasks

Unable to import default exports with ESM #427

teddybee opened this issue Dec 1, 2023 · 5 comments
Labels
bug Something isn't working interop pr welcome

Comments

@teddybee
Copy link

teddybee commented Dec 1, 2023

Precheck

  • I searched existing issues before opening this one to avoid duplicates
  • I'm able to reproduce this issue and prove it with a minimal reproduction
  • I understand this is not a place to ask for free debugging support

Problem

I would like to import a default export of a lib.
Unfortunately with tsx I couldn't do this:

import zennv from 'zennv';

export const env = zennv({...})

I got this error:
Error: _zennv.default is not a function

Expected behavior

Working with default imports.

Minimal reproduction URL

https://stackblitz.com/edit/stackblitz-starters-wkqcy7?file=package.json,src%2Findex.ts,src%2Fenv.ts

Version

v4.6.0

Node.js version

v20.10.0

Package manager

pnpm

Operating system

Windows

Contributions

  • I plan to open a pull request for this issue
  • I plan to make a financial contribution to this project
@teddybee teddybee added bug Something isn't working pending triage labels Dec 1, 2023
@privatenumber
Copy link
Owner

zod or the extra index file doesn't seem necessary for the reproduction. Please keep it minimal as isolating the bug creates more work to vet your reproduction.

@teddybee
Copy link
Author

teddybee commented Dec 1, 2023

Yes it does, as it is needed for the param of the constructor.

@privatenumber
Copy link
Owner

privatenumber commented Dec 1, 2023

Not necessary. Here's a minimal reproduction: https://stackblitz.com/edit/stackblitz-starters-sykrfb

@moimael

This comment was marked as duplicate.

@andys8

This comment has been minimized.

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

No branches or pull requests

4 participants