Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nine-ravens-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tanstack/devtools-vite': patch
---

fix issue where hosting providers would include devtools in production
18 changes: 9 additions & 9 deletions packages/devtools-vite/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,18 @@ export const devtools = (args?: TanStackDevtoolsViteConfig): Array<Plugin> => {
},
{
name: '@tanstack/devtools:remove-devtools-on-build',
apply(_, { command }) {
return command === 'build' && removeDevtoolsOnBuild
apply(config, { command }) {
// Check both command and mode to support various hosting providers
// Some providers (Cloudflare, Netlify, Heroku) might not use 'build' command
// but will always set mode to 'production' for production builds
return (
(command !== 'serve' || config.mode === 'production') &&
removeDevtoolsOnBuild
)
},
enforce: 'pre',
transform(code, id) {
if (
id.includes('node_modules') ||
id.includes('?raw') ||
id.includes('dist') ||
id.includes('build')
)
return
if (id.includes('node_modules') || id.includes('?raw')) return
const transform = removeDevtools(code, id)
if (!transform) return
if (logging) {
Expand Down
Loading