Skip to content

feat: add devtools to vite config#1

Open
morinokami wants to merge 1 commit into
bun-templates:mainfrom
morinokami:patch-0
Open

feat: add devtools to vite config#1
morinokami wants to merge 1 commit into
bun-templates:mainfrom
morinokami:patch-0

Conversation

@morinokami

@morinokami morinokami commented Dec 5, 2025

Copy link
Copy Markdown

Add @tanstack/devtools-vite to automatically remove devtools from the production build.

related: bun-templates/bun-tanstack-start#1

Comment thread src/routes/__root.tsx
Comment on lines -51 to +59
{isDevelopment && (
<TanStackDevtools
config={{
position: "bottom-right",
}}
plugins={[
{
name: "Tanstack Router",
render: <TanStackRouterDevtoolsPanel />,
},
]}
/>
)}
<TanStackDevtools
config={{
position: "bottom-right",
}}
plugins={[
{
name: "Tanstack Router",
render: <TanStackRouterDevtoolsPanel />,
},
]}
/>

@morinokami morinokami Dec 5, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Vite plugin removes all devtools related code from the production build, so we don't have to manually exclude the devtools here.

image

https://tanstack.com/devtools/latest/docs/production#vite-plugin-configuration

Comment thread vite.config.ts

const config = defineConfig({
plugins: [
devtools(),

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Vite plugin must be placed as the first plugin in the plugins array.

https://tanstack.com/devtools/latest/docs/quick-start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant