๐บ๏ธ Use the remix
package
#7823
Replies: 14 comments 8 replies
-
Absolutely love the introspection here and movement towards simplicity. With many of the recent RFCs, its been refreshing to see the project adapt and move away from old decisions/patterns with the focus on delivering a quality framework. Big thumbs up from me, and keep them coming! |
Beta Was this translation helpful? Give feedback.
-
Love it! |
Beta Was this translation helpful? Give feedback.
-
I've been using a script that re-exports the Remix API, so this will eliminate the need for that. |
Beta Was this translation helpful? Give feedback.
-
This is great, we've been importing from |
Beta Was this translation helpful? Give feedback.
-
As a package developer, this will be much appreciated, right now I need to import from the server-runtime package and that means things like createCookie doesn't work because they're not exported from there, even if they work the same. And because the internal nature of the package sometimes there are breaking changes on exported types and functions that I have to work with and become breaking changes for my packages. This will help solve that. |
Beta Was this translation helpful? Give feedback.
-
This makes a lot of sense. Love it! |
Beta Was this translation helpful? Give feedback.
-
This will greatly simplify things. Sometimes I'm unsure which package to import for a certain method/type (I didn't know that some things were the same regardless of the package). |
Beta Was this translation helpful? Give feedback.
-
What does this imply about the potential for a Preact adapter, or the "Remix sans-React" framework that Ryan talks about on Twitter sometimes? Are those not even possibilities in the future? |
Beta Was this translation helpful? Give feedback.
-
I think you could probably also collapse runtime-specific packages into |
Beta Was this translation helpful? Give feedback.
-
This is a great initiative, it will make it much easier to find the correct API's and simplify the documentation.
This is true but I don't think anything is as solid, regarding data revalidation + aborting ongoing requests as remix ๐ฅฒ |
Beta Was this translation helpful? Give feedback.
-
Is this RFC being moved forward? |
Beta Was this translation helpful? Give feedback.
-
This is a really great improvement, especially for newbies. |
Beta Was this translation helpful? Give feedback.
-
I have a question about this, at the moment there are duplicate exports in How will this be handled, will it be something like redirect/clientRedirect? |
Beta Was this translation helpful? Give feedback.
-
Like it. Assuming this would also help the "remix" weekly downloads more closely reflect adoption? The flat ~20k weekly downloads for "remix" on npm trends isn't as compelling to folks making framework comparisons as the steadily increasing ~300k downloads for the @remix-run/* packages. |
Beta Was this translation helpful? Give feedback.
-
Background
When importing from
@remix-run/{runtime}
(@remix-run/node
, etc.), you're often importing the same code regardless of the runtime. This complicates the docs, third party package development, and shared code across an organization deploying Remix multiple places.When Remix first started we had never seen anybody create adapters for multiple hosting platforms around the Web Fetch Request/Response APIs. We originally designed it so that the
@remix-run/{runtime}
packages were responsible for polyfilling the environment with the web APIs needed, which led to apps importing server things from@remix-run/{runtime}
. We anticipated the types and implementations would all be dependent on the specific polyfill so it seemed reasonable.Through the course of building Remix, we started moving shared runtime things into the internal dependency
@remix-run/server-runtime
. By the time we were done, the types did not actually end up being the types for the polyfill due to TS constraints, and the majority of a runtime packages were just re-exporting from@remix-run/server-runtime
.This not only makes upgrading, documenting, and using Remix more complicated than it needs to be, it makes building third-party packages for Remix more complicated too.
Fast forward three years and lots of runtimes now have the fetch API. Polyfilling isn't as needed and may soon not be needed at all. In v2 we took advantage of this and moved the responsibility to polyfill to the app, rather than the
@remix-run/{runtime}
packages.In the beginning of Remix, we also wanted to leave the door open for making the rendering library pluggable, hence
@remix-run/react
.Fast forward three years again and we've seen nearly every rendering lib implement their own remix-like framework with loaders, actions, adapters, nested routes, etc. We were interested in collaborating as a shared framework, but not interested in competing directly (we wish them well, they've done great work).
We also really like the core ideas behind RSC in React. Making the rendering lib pluggable would prove to be a huge challenge and make Remix with React vs. something else very different. This is no longer a goal of the project.
Considering all of this, we can now move all shared code from both
@remix-run/server-runtime
and@remix-run/react
toremix
and simplify the package structure for apps and third party packages.Proposal
@remix-run/server-runtime
toremix
@remix-run/react
toremix
@remix-run/server-runtime
and simply declareremix
as apeerDependency
.This means the vast majority of imports in an app will be from
"remix"
because they work everywhere:Only runtime specific things will be imported from a runtime or adapter package:
In practice, some apps won't even need a runtime package if they don't use anything specific to that runtime.
Strategy
Moving a bunch of code around at once would basically force a code freeze and invalidate every PR we've got. We'll take an iterative approach instead:
remix
package will simply re-export everything from@remix-run/react
and all runtime agnostic APIs from@remix-run/server-runtime
(just like runtime packages do today)remix
package to not disrupt the codebase too much. At this point the runtime package will re-export it from the "remix" package. We may need a third, temporary and silly internal package to avoid circular dependencies.@remix-run/server-runtime
and@remix-run/react
, for organizational reasons, but they would not be dependencies of a Remix app, but internal dependencies ofremix
.Beta Was this translation helpful? Give feedback.
All reactions