@vercel/remix
Advanced tools
Changelog
v2.9.2
Date: 2024-05-10
In 2.9.2 we've enhanced the type-safety when opting into the future.unstable_singleFetch
feature. Previously, we added the response
stub to LoaderFunctionArgs
and used type overrides for inference on useLoaderData
, etc., but we found that it wasn't quite enough.
With this release we're introducing new functions to assist the type-inference when using single fetch - defineLoader
/defineAction
and their client-side counterparts defineClientLoader
and nd defineClientAction
. These are identity functions; they don't modify your loader or action at runtime. Rather, they exist solely for type-safety by providing types for args and by ensuring valid return types.
export const loader = defineLoader(({ request }) => {
// ^? Request
return { a: 1, b: () => 2 };
// ^ type error: `b` is not serializable
});
Note that defineLoader
and defineAction
are not technically necessary for defining loaders and actions if you aren't concerned with type-safety:
// this totally works! and typechecking is happy too!
export const loader = () => {
return { a: 1 };
};
This means that you can opt-in to defineLoader
incrementally, one loader at a time.
Please see the Single Fetch docs for more information.
@remix-run/dev
- Vite: Fix dest already exists
error when running remix vite:build
(#9305)@remix-run/dev
- Vite: Fix issue resolving critical CSS during development when route files are located outside of the app directory (#9194)@remix-run/dev
- Vite: Remove @remix-run/node
from Vite plugin's optimizeDeps.include
list since it was unnecessary and resulted in Vite warnings when not depending on this package (#9287)@remix-run/dev
- Vite: Clean up redundant ?client-route=1
imports in development (#9395)@remix-run/dev
- Vite: Ensure Babel config files are not referenced when applying the react-refresh
Babel transform within the Remix Vite plugin (#9241)@remix-run/react
- Type-safety for single-fetch: defineLoader
, defineClientLoader
, defineAction
, defineClientAction
(#9372)@remix-run/react
- Single Fetch: Add undefined
to useActionData
type override (#9322)@remix-run/react
- Single Fetch: Allow a nonce
to be set on single fetch stream transfer inline scripts via <RemixServer>
(#9364)@remix-run/server-runtime
- Single Fetch: Don't log thrown response stubs via handleError
(#9369)@remix-run/server-runtime
- Single Fetch: Automatically wrap resource route naked object returns in json()
for back-compat in v2 (and log deprecation warning) (#9349)@remix-run/server-runtime
- Single Fetch: Pass response
stub to resource route handlers (#9349)@remix-run/cloudflare
@remix-run/cloudflare-pages
@remix-run/cloudflare-workers
@remix-run/css-bundle
@remix-run/deno
@remix-run/dev
@remix-run/eslint-config
@remix-run/express
@remix-run/node
@remix-run/react
@remix-run/serve
@remix-run/server-runtime
@remix-run/testing
Full Changelog: v2.9.1...v2.9.2
Changelog
v2.9.1
Date: 2024-04-24
@remix-run/dev
- Fix issue where consumers who had added Remix packages to Vite's ssr.noExternal
option were being overridden by the Remix Vite plugin adding Remix packages to Vite's ssr.external
option (#9301)@remix-run/react
- Ignore future/*.d.ts
files from TS build (#9299)Full Changelog: v2.9.0...v2.9.1
Changelog
v2.9.0
Date: 2024-04-23
2.9.0
introduces a future.unstable_singleFetch
flag to enable to Single Fetch behavior (RFC) in your Remix application. Please refer to the docs for the full detail but the high-level changes to be aware of include:
loader
/action
functions are no longer automatically serialized to JSON responses
turbo-stream
which allows direct serialization of more complex types such as Promise
, Date
, Map
instances, and moretsconfig.json
's compilerOptions.types
array to infer types properly when using Single Fetchheaders
export is no longer used when Single Fetch is enabled in favor of a new response
stub passed to your loader
/action
functionsjson
/defer
/redirect
utilities are deprecated when using Single Fetch (but still work mostly the same)4xx
/5xx
responses - you can return a 2xx
to opt-into revalidation or use shouldRevalidate
[!IMPORTANT] Single Fetch requires using
undici
as your fetch polyfill, or using the built-in fetch on Node 20+, because it relies on APIs available there but not in the@remix-run/web-fetch
polyfill. Please refer to the Undici section below for more details.
- If you are managing your own server and calling
installGlobals()
, you will need to callinstallGlobals({ nativeFetch: true })
to avoid runtime errors when using Single Fetch- If you are using
remix-serve
, it will useundici
automatically if Single Fetch is enabled
Remix 2.9.0
adds a new installGlobals({ nativeFetch: true })
flag to opt into using undici
for the Web Fetch polyfills instead of the @remix-run/web-*
packages. This change has a few primary benefits:
undici
, so beware of "breaking bug fixes" and keep an eye on any advanced fetch
API interactions you're performing in your appundici
may have different behavior by design -- most notably, undici
's garbage collection behavior differs and you are required to consume all fetch response bodies to avoid a memory leak in your appundici
is the fetch implementation used by node
internally, it should better prepare Remix apps to more smoothly drop the polyfill to use the built-in Node.js APIs on node
20+future.unstable_singleFetch
flag (#8773, #9073, #9084, #9272)@remix-run/node
- Add a new installGlobals({ nativeFetch: true })
flag to opt-into using undici
as the fetch polyfill instead of @remix-run/web-*
(#9106, #9111, #9198)@remix-run/server-runtime
- Add ResponseStub
header interface and deprecate the headers
export when Single Fetch is enabled (#9142)create-remix
- Allow .
in repo name when using --template
flag (#9026)@remix-run/dev
- Improve getDependenciesToBundle
resolution in monorepos (#8848)@remix-run/dev
- Fix SPA mode when Single Fetch is enabled by using streaming entry.server
(#9063)@remix-run/dev
- Vite: added sourcemap support for transformed routes (#8970)@remix-run/dev
- Update links printed to the console by the Remix CLI/Dev Server to point to updated docs locations (#9176)@remix-run/server-runtime
- Handle redirects created by handleDataRequest
(#9104)create-remix
@remix-run/architect
@remix-run/cloudflare
@remix-run/cloudflare-pages
@remix-run/cloudflare-workers
@remix-run/css-bundle
@remix-run/deno
@remix-run/dev
@remix-run/eslint-config
@remix-run/express
@remix-run/node
@remix-run/react
@remix-run/serve
@remix-run/server-runtime
@remix-run/testing
Full Changelog: v2.8.1...v2.9.0
Changelog
v2.8.1
Date: 2024-03-07
@remix-run/dev
- Vite: Support reading from Vite config when running remix reveal
and remix routes
CLI commands (#8916)@remix-run/dev
- Vite: Clean up redundant client route query strings on route JavaScript files in production builds (#8969)@remix-run/dev
- Vite: Add vite commands to Remix CLI --help
output (#8939)@remix-run/dev
- Vite: Fix support for build.sourcemap
option in Vite config (#8965)@remix-run/dev
- Vite: Fix error when using Vite's server.fs.allow
option without a client entry file (#8966)@remix-run/react
- Strengthen the internal LayoutComponent
type to accept limited children (#8910)create-remix
@remix-run/architect
@remix-run/cloudflare
@remix-run/cloudflare-pages
@remix-run/cloudflare-workers
@remix-run/css-bundle
@remix-run/deno
@remix-run/dev
@remix-run/eslint-config
@remix-run/express
@remix-run/node
@remix-run/react
@remix-run/serve
@remix-run/server-runtime
@remix-run/testing
Full Changelog: v2.8.0...v2.8.1
Changelog
v2.8.0
Date: 2024-02-28
@remix-run/dev
- Vite: Pass resolved viteConfig
to Remix Vite plugin's buildEnd
hook (#8885)@remix-run/dev
- Mark Layout
as browser safe route export in esbuild
compiler (#8842)@remix-run/dev
- Vite: Silence build warnings when dependencies include "use client"
directives (#8897)@remix-run/dev
- Vite: Fix serverBundles
issue where multiple browser manifests are generated (#8864)@remix-run/dev
- Vite: Support custom build.assetsDir
option (#8843)@remix-run/react
- Fix the default root ErrorBoundary
component so it leverages the user-provided Layout
component (#8859)@remix-run/react
- Fix the default root HydrateFallback
component so it leverages any user-provided Layout
component (#8892)create-remix
@remix-run/architect
@remix-run/cloudflare
@remix-run/cloudflare-pages
@remix-run/cloudflare-workers
@remix-run/css-bundle
@remix-run/deno
@remix-run/dev
@remix-run/eslint-config
@remix-run/express
@remix-run/node
@remix-run/react
@remix-run/serve
@remix-run/server-runtime
@remix-run/testing
Full Changelog: v2.7.2...v2.8.0