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

Add support for exports. #1 #2

Closed
wants to merge 2 commits into from
Closed

Conversation

chmac
Copy link

@chmac chmac commented May 17, 2019

Not sure if this is the correct strategy or not, but it fixes the issue I described in #1 for me.

@ansuz
Copy link
Contributor

ansuz commented May 20, 2019

It's a bit surprising that Typescript can't use what should be supplied by module.exports, since that would make it incompatible with the majority of the nodejs ecosystem.

I'm not against just accepting this PR, but we're planning on adding support for nodejs in a bunch of other modules which are currently clientside-only, and I'd like to know the underlying reason why this format isn't compatible with Typescript.

I don't know much about typescript but a short search suggests that it might have something to do with our code not having a clearly defined type.

I also found this repo which provides examples of how to define modules for various use cases. I'm not sure if Typescript is considered.

@chmac
Copy link
Author

chmac commented May 20, 2019

@ansuz Likewise, I assumed that Typescript would define module.exports, but that didn't seem to work. To be clear though, I'm running typescript via create-react-app which actually uses webpack to build the bundle and then serve it from typescript. To get the same setup running here is a minimum reproduction to show the error:
https://github.com/chmac/typescript-chainpad-crypto

My typescript fu is limited, I was surprised I found such a simple option in adding exports!

@chmac
Copy link
Author

chmac commented May 29, 2019

I'm going to close this because this approach doesn't actually work with TypeScript. I'll post more info on the issue I opened #1 and hope we can figure out a solution there.

@chmac chmac closed this May 29, 2019
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

Successfully merging this pull request may close these issues.

2 participants