Skip to content

Commit b5d8124

Browse files
committed
fix: remove completely devtools in hosting providers
1 parent a5448af commit b5d8124

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

packages/devtools-vite/src/plugin.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,14 @@ export const devtools = (args?: TanStackDevtoolsViteConfig): Array<Plugin> => {
178178
},
179179
{
180180
name: '@tanstack/devtools:remove-devtools-on-build',
181-
apply(_, { command }) {
182-
return command === 'build' && removeDevtoolsOnBuild
181+
apply(config, { command }) {
182+
// Check both command and mode to support various hosting providers
183+
// Some providers (Cloudflare, Netlify, Heroku) might not use 'build' command
184+
// but will always set mode to 'production' for production builds
185+
return (
186+
(command !== 'serve' || config.mode === 'production') &&
187+
removeDevtoolsOnBuild
188+
)
183189
},
184190
enforce: 'pre',
185191
transform(code, id) {

0 commit comments

Comments
 (0)