Adding new example apps to show the usage of the tweet outside Next.js, here are some issues encountered so far:
When importing the module in Node.js unless an experimental flag is enabled all imports need to specify a file extension. This has been temporarily solved by adding the file extension manually to the files inside next-tweet/api, which are the only ones that have an use case when being imported in Node.js, and that way we can avoid needing to add an experimental flag.
create-react-app does not work due to a similar issue with extensions: https://github.com/facebook/create-react-app/issues/11865. This is a non issue in Next.js, Vite and others where the extension does not have to be specified. One solution here can be to include an extension to all files in imports of the package for wider support.
The Vite example is CSR only. I think that's okay for now because there's too much boilerplate code to do SSR.
next/image is temporarily removed. Providing a way to implement it for Next.js and still support other providers would be helpful. Something like making NextTweet be Next.js only and the adding a new ReactTweet component. The Tweet name is being used by a type so that's not available 🤔
I'll be working on other examples soon to see what other issues come up with the package.
SWC does not allow adding an extension and that could be an easy fix for the first 2 issues.
Update
I got it working with create-react-app after making every import include an extension in the source of next-tweet, so that the output always has an extension. This is also good for Node.js ESM
Gatsby RSC did not work unfortunately. I'll create an issue that contains all the issues I found during the process
branch changed to next. I'm expecting more updates before merging to main
Adding new example apps to show the usage of the tweet outside Next.js, here are some issues encountered so far:
next-tweet/api
, which are the only ones that have an use case when being imported in Node.js, and that way we can avoid needing to add an experimental flag.create-react-app
does not work due to a similar issue with extensions: https://github.com/facebook/create-react-app/issues/11865. This is a non issue in Next.js, Vite and others where the extension does not have to be specified. One solution here can be to include an extension to all files in imports of the package for wider support.next/image
is temporarily removed. Providing a way to implement it for Next.js and still support other providers would be helpful. Something like makingNextTweet
be Next.js only and the adding a newReactTweet
component. TheTweet
name is being used by a type so that's not available 🤔I'll be working on other examples soon to see what other issues come up with the package.
SWC does not allow adding an extension and that could be an easy fix for the first 2 issues.
Update
create-react-app
after making every import include an extension in the source of next-tweet, so that the output always has an extension. This is also good for Node.js ESMnext
. I'm expecting more updates before merging tomain