Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Start BETA - Tracking#2863

SeanCassiere started this conversation inGeneral
Discussion options

Tracking any important changes for TanStack Start during the BETA period.

If you are coming from the ALPHA of TanStack Start, you can see all the breaking changes that were made here -#2403

You must be logged in to vote

Replies: 9 comments

Comment options

SeanCassiere
Nov 27, 2024
Maintainer Author

v1.83.0 - Changed export variable renamed fromRoute toAPIRoute

Important

Breaking change for users of API Routes

We've changed the name of the variable that's picked up by the API handler for routes that have API Routes configured.

// app/routes/api.foo.tsximport { createAPIFileRoute } from '@tanstack/start/api'- export const Route = createAPIFileRoute('/api/foo')({+ export const APIRoute = createAPIFileRoute('/api/foo')({    GET: () => {        return new Response('Hello world')    }})
You must be logged in to vote
0 replies
Comment options

v1.105.0 -<HeadContent> replaces<Meta>

<Meta> was replaced by<HeadContent>.
<Scripts> moved into@tanstack/react-router

This is non-breaking, but<Meta> is now deprecated and will be removed later.

 // app/routes/__root.tsx-import { createRootRoute } from '@tanstack/react-router'+import { createRootRoute, HeadContent, Scripts } from '@tanstack/react-router' import { Outlet } from '@tanstack/react-router'-import { Meta, Scripts } from '@tanstack/start' import * as React from 'react'  export const Route = createRootRoute({@@ -231,7 +230,7 @@ function RootDocument({ children }: { children: React.ReactNode }) {   return (     <html>       <head>-        <Meta />+        <HeadContent />       </head>       <body>         {children}
You must be logged in to vote
0 replies
Comment options

v1.111.10 - renamed package from@tanstack/start to@tanstack/react-start

@tanstack/start was renamed to@tanstack/react-start.

This is non-breaking, but@tanstack/start is now deprecated and will be removed later.

You must be logged in to vote
0 replies
Comment options

SeanCassiere
Mar 11, 2025
Maintainer Author

⏱️ coming soon, moving from./app to./src

As part of our Vite + Nitro migration, we'll be changing the default base app directory for TanStack Start, from./app to./src, which will be moreVite-native.

If you'd like to opt-in to this behaviourearly, you can make these changes, to move from `./app` to `./src`.

  1. Settsr.appDirectory to./src in yourapp.config.ts.
// app.config.tsimport { defineConfig } from '@tanstack/react-start/config'export default defineConfig({+tsr: {+appDirectory: './src'+}// ...})
  1. If you are using path aliases, change the source from./app to./src in yourtsconfig.json.
{"compilerOptions": {"paths": {-"~/*": ["app/*"]+"~/*": ["./src/*"]}}}
  1. If you are using TailwindCSS, change the content source from./app to./src in yourtailwind.config.js
// tailwind.config.js/** @type {import('tailwindcss').Config} */export default {-  content: ['./app/**/*.{js,jsx,ts,tsx}'],+  content: ['./src/**/*.{js,jsx,ts,tsx}'],}
  1. Rename theapp folder tosrc.

If you run into any issues, feel free to hop into ourDiscord server and create a question in the#start-questions channel.

To give you the best 'new user experience', we've already updated the examples (#3712). Documentation changes, shouldn't be too far behind.

This post will be deleted/hidden, once the Vite + Nitro migration has been completed and merged in.

You must be logged in to vote
0 replies
Comment options

SeanCassiere
May 11, 2025
Maintainer Author

v1.121.0

We merged "devinxi" alpha to main. please follow the steps below to upgrade.

Move to the framework adapter

As mentioned earlier in thismessage, we're moving all released to framework-specific adapters. As such, we'll no longer be publishing/updating the@tanstack/start package.

npm uninstall @tanstack/startnpm install @tanstack/react-start

Migration guide

We've made a few keybreaking changes that you'll need to make when upgrading
tov1.121.0.

These changes have been broken down into thelarge sweeping changes,smaller changes,
andoptional ones.

Important

Before going through this guide, make sure that you've backed up your project and have it
committed to version control (like Git) in a working state.

Core Migration

Let's go! 🚅

Swap to Vite

You'll need to remove thevinxi package and install Vite 6+.

npm uninstall vinxinpm install vite

Update your packages

You'll need to update any of the TanStack Router or Start packages to latest.

# This is not an exhaustive list of packages.# Look at your `package.json` for the packages you'd need to upgrade.npm install @tanstack/react-router@latest @tanstack/react-router-devtools@latestnpm install @tanstack/react-start@latest

If you are using SolidJS, swap out thereact- prefix forsolid-.

Update yourscripts

You'll need to update thescripts in yourpackage.json to use the Vitedev andbuild commands.

{"scripts": {"dev":"vite dev --port 3000","build":"vite build","start":"node .output/server/index.mjs"  }}

app.config.ts tovite.config.ts

TanStack Start is now a Vite plugin. So, register the plugin in a Vite config file and deleteapp.config.ts.

// vite.config.tsimport{defineConfig}from'vite'importtsconfigPathsfrom'vite-tsconfig-paths'import{tanstackStart}from'@tanstack/react-start/plugin/vite'exportdefaultdefineConfig({plugins:[tsconfigPaths(),// tailwindcss(), sentry(), ...tanstackStart({/** Add your options here */})]})

Renameapp/ tosrc/

We're staying Vite-native. All your source code should be moved fromapp/ tosrc/.

mv app src

if you use a path alias in yourtsconfig.json, make sure to also update that tosrc:

"paths": {"@/*": ["./src/*"      ]    },

You needsrc/router.tsx

You'll need to make sure that you have yourcreateRouter function
exported out ofsrc/router.tsx.

// src/router.tsximport{createRouterascreateTanStackRouter}from'@tanstack/react-router'import{routeTree}from'./routeTree.gen'exportfunctioncreateRouter(){constrouter=createTanStackRouter({    routeTree,scrollRestoration:true,})returnrouter}declare module'@tanstack/react-router'{interfaceRegister{router:ReturnType<typeofcreateRouter>}}

Deletesrc/client.tsx andsrc/ssr.tsx

If you didNOT customize yoursrc/client.tsx andsrc/ssr.tsx files, then you can delete them.

rm -rf src/client.tsxrm -rf src/ssr.tsx

However, if you did customize the these files, like installing when installing the Clerk adapter,
then you'll need to rename thesrc/ssr.tsx file tosrc/server.tsx.

mv src/ssr.tsx src/server.tsx

If you are using a customserver.tsx entry, then the overall structure of the file (including
the default export) should look something similar to this.

// src/server.tsximport{createStartHandler,defaultStreamHandler}from'@tanstack/react-start/server'import{createRouter}from'./router'exportdefaultcreateStartHandler({  createRouter,})(defaultStreamHandler)

Devinxi - Changes to your TanStack Start config

TODO: List out all the changes

We've moved around some of the options in the TanStack Start config.

// vite.config.tsimport{defineConfig}from'vite'import{tanstackStart}from'@tanstack/react-start/plugin/vite'exportdefaultdefineConfig({plugins:[tanstackStart({// The changes are...})]})

Devinxi - Migrating from API Routes to Server Routes

API routes have seen a huge improvement and we're now calling them "Server Routes".

First, delete thesrc/api.ts entry handler.

rm -rf src/api.ts

In your API routes files, you'll need to make the following changes to turn them into Server Routes.

// src/routes/api/users.tsximport { json } from '@tanstack/react-start'- import { createAPIFileRoute } from '@tanstack/react-start/api'import { fetchUsers } from '../../utils/users'- export const APIRoute = createAPIFileRoute('/api/users')({+ export const ServerRoute = createServerFileRoute().methods({  GET: async ({ request, params }) => {    console.info('Fetching users... @', request.url)    const users = await fetchUsers()    // You can now call Server Functions from here 🥳    return json(users)  },})

You more easily find these routes by search for the imports from@tanstack/react-start/api.

Not migrating at this time

If you decide that right now is not the appropriate time to migrate you will need to pin your versions of@tanstack/react-start (as well as several other related libraries). We have built a simple helper function intocreate-start-app to help you with this process:npx create-start-app@latest pin-versions. Simply execute that command in your application's root directory and the command will make the necessary adjustments to yourpackage.json file. Then you can remove thenode_modules directory as well as package lock files, and re-install and you should be able to continue with your development and upgrade when you choose.

You must be logged in to vote
0 replies
Comment options

⏱️ coming soon, no more autoconfiguring of solid/react vite plugin

TanStack Start will soon stop auto-configuring React/Solid Vite plugins.
You’ll get full control - choose @vitejs/plugin-react, @vitejs/plugin-react-oxc, etc.

You can already now experience that withcustomViteReactPlugin: true

grafik

You must be logged in to vote
0 replies
Comment options

v1.127.3 - Changedrouter.isShell torouter.isShell()

Important

Breaking change for users of SPA mode

We've changed the shell detection during SPA mode build from a variablerouter.isShell to a function invocationrouter.isShell()

You must be logged in to vote
0 replies
Comment options

v1.131.0 - renamed query integration to@tanstack/react-router-ssr-query

this also changes the API of that package

seehttps://tanstack.com/router/latest/docs/integrations/query

You must be logged in to vote
0 replies
Comment options

Start RC - v1.132

deployment

Start is not coupled with Nitro anymore by default.
You can use a nitro vite plugin to get the same deployment behavior as with beta:

import{tanstackStart}from'@tanstack/react-start/plugin/vite'import{defineConfig}from'vite'importviteReactfrom'@vitejs/plugin-react'import{nitroV2Plugin}from'@tanstack/nitro-v2-vite-plugin'exportdefaultdefineConfig({plugins:[tanstackStart(),nitroV2Plugin(/*      // nitro config goes here, e.g.      { target: 'node-server' }    */),viteReact(),],})

The documentation contains a variety of deployment configurations that are now possible (with and without nitro):

https://tanstack.com/start/latest/docs/framework/react/hosting

minimum node version

minimum node version was set to 22.12

minimum vite version 7

make sure to update vite to v7

no more autoconfiguring of solid/react vite plugin

add the react / solid plugin of your choice to your vite config:

import{defineConfig}from'vite'import{tanstackStart}from'@tanstack/react-start/plugin/vite'importviteReactfrom'@vitejs/plugin-react'exportdefaultdefineConfig({server:{port:3000,},plugins:[tanstackStart(),viteReact(),],})

tanstackStart vite plugin config changes

  • tsr prop was renamed torouter
export default defineConfig({       projects: ['./tsconfig.json'],     }),     tanstackStart({-      tsr: {+      router: {         virtualRouteConfig: './routes.ts',       },     }),
  • tsr.srcDirectory prop was moved up to top level
export default defineConfig({   },   plugins: [     tanstackStart({-      tsr: {-        srcDirectory: './src/app',-      },+      srcDirectory: './src/app',     }),   ], })

validator renamed toinputValidator

export const greetUser = createServerFn({ method: 'GET' })-  .validator((data: { name: string }) => data)+  .inputValidator((data: { name: string }) => data)  .handler(async ({ data }) => {    return `Hello, ${data.name}!`  })

static server functions moved into a middleware

import{createServerFn}from'@tanstack/react-start'import{staticFunctionMiddleware}from'@tanstack/start-static-server-functions'constmyServerFn=createServerFn({method:'GET'}).middleware([staticFunctionMiddleware]).handler(async()=>{return'Hello, world!'})

Ensure thatstaticFunctionMiddleware is the final middleware!

renaming

  • getWebRequest renamed togetRequest

  • getHeaders renamed togetRequestHeaders

  • getHeader renamed togetRequestHeader

  • setHeaders renamed tosetResponseHeaders

  • setHeader renamed tosetResponseHeader

  • parseCookies renamed togetCookies

  • serverOnly renamed tocreateServerOnlyFn

  • clientOnly renamed tocreateClientOnlyFn

router.tsx

export was renamed togetRouter:

- export function createRouter() {+ export function getRouter() {     return createRouter({        routeTree,        // ...     })  }

module declaration is now autogenerated in routeTree.gen.ts

Server functions

response modes have been removed. just return aResponse if you want to return a raw Response.

Server request entry point ("server.ts") signature changed:

The entry point must conform to the following interface:

exportdefault{fetch(req:Request):Promise<Response>{// ...},}

unified route tree for server routes

- import { createServerFileRoute } from '@tanstack/react-start/server'+ import { createFileRoute } from '@tanstack/react-router'- export const ServerRoute = createServerFileRoute('/hello').methods({+ export const Route = createFileRoute('/hello')({+  server: {+    handlers: {      GET: async ({ request }) => {        return new Response('Hello, World!')      },+   },+  },})

global middleware

registerGlobalMiddlware was removed.
please read the docs about global middleware:https://tanstack.com/start/latest/docs/framework/react/middleware#global-middleware

custom client entrypoint client.tsx

-import { StartClient } from '@tanstack/react-start'+import { StartClient } from '@tanstack/react-start/client'import { StrictMode } from 'react'import { hydrateRoot } from 'react-dom/client'hydrateRoot(  document,  <StrictMode>-    <StartClient router={router} />+   <StartClient />  </StrictMode>,)

other changes

  • removed deprecatedMeta andScripts exports from solid/react start
You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
General
Labels
None yet
2 participants
@SeanCassiere@schiller-manuel

[8]ページ先頭

©2009-2025 Movatter.jp