File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed
packages/devtools-vite/src Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @tanstack/devtools-vite ' : patch
3+ ---
4+
5+ fix issue where hosting providers would include devtools in production
Original file line number Diff line number Diff line change @@ -178,18 +178,18 @@ 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 ) {
186- if (
187- id . includes ( 'node_modules' ) ||
188- id . includes ( '?raw' ) ||
189- id . includes ( 'dist' ) ||
190- id . includes ( 'build' )
191- )
192- return
192+ if ( id . includes ( 'node_modules' ) || id . includes ( '?raw' ) ) return
193193 const transform = removeDevtools ( code , id )
194194 if ( ! transform ) return
195195 if ( logging ) {
You can’t perform that action at this time.
0 commit comments