From ebb6ecf558921cc3faedc303118769dbedf0cfb4 Mon Sep 17 00:00:00 2001 From: DACONLEEHANGYU Date: Sun, 25 Jan 2026 22:44:26 +0900 Subject: [PATCH] fix(svelte-query): suppress false positive unused import warnings Fixes #9740 Added rollup onwarn handler to suppress UNUSED_EXTERNAL_IMPORT warnings for @tanstack/query-core imports. These warnings are false positives as the imports (notifyManager, replaceEqualDeep) are actually used in the compiled code but Rollup's tree-shaking analysis fails to detect this in Svelte 5's runes context ($effect, $state, $derived). The warning appeared during SvelteKit project builds mentioning: - notifyManager (used in createMutation.svelte.ts) - replaceEqualDeep (used in useMutationState.svelte.ts) --- packages/svelte-query/vite.config.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/svelte-query/vite.config.ts b/packages/svelte-query/vite.config.ts index 1ed8e56135..6b910a56e4 100644 --- a/packages/svelte-query/vite.config.ts +++ b/packages/svelte-query/vite.config.ts @@ -17,6 +17,21 @@ export default defineConfig({ }, }, }, + build: { + rollupOptions: { + onwarn(warning, warn) { + // Suppress false positive "unused import" warnings from @tanstack/query-core + // These imports (notifyManager, replaceEqualDeep) are actually used in the code + if ( + warning.code === 'UNUSED_EXTERNAL_IMPORT' && + warning.message?.includes('@tanstack/query-core') + ) { + return + } + warn(warning) + }, + }, + }, test: { name: packageJson.name, dir: './tests',