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

change how package.json specifies types file #404

Merged
merged 3 commits into from Apr 25, 2024

Conversation

derrickstaten
Copy link
Contributor

In a personal project, tweaking package.json led my IDE to start recognizing the types provided in webR. Without this I get compile-time warnings in the IDE.

I'm inexperienced, so others should double check this.

@WillemSleegers
Copy link

This throws an error for me when I use it in a Next.JS project; I had to reorder the exports so the default option is the last one.

@derrickstaten
Copy link
Contributor Author

Oh interesting. Again I'm a novice here and have absolutely no clue why order of key-value pairs would matter there.

Would you like me to update the PR with default as the last key inside the exports object?

@WillemSleegers
Copy link

That makes sense to me but I should note I'm also no expert!

@derrickstaten
Copy link
Contributor Author

Done! Hopefully this works well on your end too.

@georgestagg
Copy link
Member

Thanks for this! Fixes #254.

I've made a couple of tweaks:

  • webr -> webR
  • Move types property to the top of the list [1].
  • Added a similar setup for webr/chan/serviceworker export.

Hopefully this still works OK for you both. I'll merge once the GitHub Actions CI is happy, but feel free to continue the thread here if any further issues crop up in your editors.

[1] The TypeScript documentation says "The "types" condition should always come first in "exports".

@georgestagg georgestagg merged commit 4104844 into r-wasm:main Apr 25, 2024
3 checks passed
@derrickstaten derrickstaten deleted the package-json-types branch April 25, 2024 13:02
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.

None yet

3 participants