fix: proper mjs file extension to support astro, and NextJS 13 app directory support#240
Merged
Conversation
|
Thanks 🥹✨ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #238
Resolves #219
Astro Support: All I changed for this was adding
.mjsto the extension of all of the files inside thedist/esmdirectory, because Astro seems to be happier with importing those than when they ended in just.js(even thoughpackage.jsonmentions they are for ESM; so this is probably an Astro bug, but 🤷🏼♂️)NextJS 13 (Server Component) Support: The primary issue is around
createContextbeing used, so I had to create a completely separate distribution targeted to be used in server components, where none of the icons import the context. I would like to have just addedIconoirContext.server.mjs(like React Native supports) and just returned a dummy context, but, alas, server components does not support that and instead requires a new entry inside theexportsconfiguration onpackage.json, which means I have to create a completely separate version of the package.If you are using IconoirProvider inside a NextJS server component, you will receive a warning in the console at build time (since NextJS does not support server components), but not if you use any other icon.