UNUSED_EXTERNAL_IMPORT build warning with Vite, Rollup, or Nuxt
Last edited: 2/19/2026
When bundling an application that uses @supabase/supabase-js, you may see warnings like:
1"PostgrestError" is imported from external module "@supabase/postgrest-js" but never used in "...supabase-js/dist/index.mjs".2"FunctionRegion", "FunctionsError", "FunctionsFetchError", "FunctionsHttpError" and "FunctionsRelayError" are imported from external module "@supabase/functions-js" but never used in "...".This is a false positive — your bundle is correct and no code is missing.
Why this happens
@supabase/supabase-js re-exports error types like PostgrestError and FunctionsError so you can import them directly from @supabase/supabase-js. The build tool merges all imports from the same package into a single statement in the output:
1// dist/index.mjs (simplified)2import { PostgrestClient, PostgrestError } from '@supabase/postgrest-js'3// ^ used internally ^ re-exported for youVite/Rollup checks which names from that import are referenced in the code body and flags PostgrestError as unused, because it only appears in an export statement — not called or assigned. The export itself is the real usage, but this check doesn't account for re-exports. Tree-shaking and bundle size are unaffected.
Suppress the warning
Vite / Rollup (vite.config.js or rollup.config.js)
1export default {2 build: {3 rollupOptions: {4 onwarn(warning, warn) {5 if (warning.code === 'UNUSED_EXTERNAL_IMPORT' && warning.exporter?.includes('@supabase/'))6 return7 warn(warning)8 },9 },10 },11}Nuxt (nuxt.config.ts)
This issue has been resolved in @nuxtjs/supabase version 2.0.4. If you are on that version or later, you do not need to apply this workaround.
1export default defineNuxtConfig({2 vite: {3 build: {4 rollupOptions: {5 onwarn(warning, warn) {6 if (warning.code === 'UNUSED_EXTERNAL_IMPORT' && warning.exporter?.includes('@supabase/'))7 return8 warn(warning)9 },10 },11 },12 },13})