-
Notifications
You must be signed in to change notification settings - Fork 4
Unable to import map-transform
in a TypeScript/JS project
#131
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
Comments
map-transform
in a TypeScriptmap-transform
in a TypeScript project
Hi, @oderayi! This works in other repos, so we need a bit more information to pinpoint why it doesn't work in your case. Do you have a public repo where we can see your code? Also, it sounds like what would happen if you don't do |
Thanks for the quick response @kjellmorten I created a JS test-repo here. Seems Simply run the test. The |
map-transform
in a TypeScript projectmap-transform
in a TypeScript/JS project
You're absolutely right and I see the problem now, @oderayi.
If you can change your project to be an ESM package too, it should work. If not, I don't think there is a workaround. Sorry again. |
@oderayi, I just stumbled upon this, which seems to let you import an ESM package in a non-ESM package. https://nodejs.org/en/blog/announcements/v22-release-announce#support-requireing-synchronous-esm-graphs |
Thank you @kjellmorten. |
Just to add, with a library like tsup, both ESM and CommonJS builds can be produced from a single TS project, with minimal config. |
Thanks, @oderayi! It looks like |
@kjellmorten I decided this morning to open a PR to enable CommonJS distribution using tsup as mentioned in my comment above. Output is the same as with I did this because we ran into a number issues in our project, which includes:
I hope my PR will be considered. |
Hi again, @oderayi, and thanks for this! I've been traveling, so I haven't had the chance to look at this, and to make a change like this I need make sure I understand all the consequences. I'll look at your PR as soon as possible. |
I am unable to use
map-transform
in a TypeScript project with the followingimport
statement:import mapTransform from 'map-transform
Error reported is:
Cannot find module 'map-transform' or its corresponding type declarations.ts(2307)
The text was updated successfully, but these errors were encountered: