fix: proper mjs file extension to support astro, and NextJS 13 app directory support #240
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
.mjs
to the extension of all of the files inside thedist/esm
directory, because Astro seems to be happier with importing those than when they ended in just.js
(even thoughpackage.json
mentions they are for ESM; so this is probably an Astro bug, but 🤷🏼♂️)NextJS 13 (Server Component) Support: The primary issue is around
createContext
being 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 theexports
configuration 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.