Skip to content

Conversation

@pffigueiredo
Copy link

@pffigueiredo pffigueiredo commented Feb 6, 2026

Description

mergeConfigDedup assumed every entry in the plugins array is a single Plugin object with a .name property. However, Vite's PluginOption type allows plugins to be arrays (nested), falsy values, or promises. Plugins like @tailwindcss/vite return Plugin[] — a standard Vite convention called "plugin presets." This caused mergeConfigDedup to fail because it accessed .name on an array.

FIXES

  • Flatten nested plugin arrays recursively before deduplication (handles @tailwindcss/vite and similar)
  • Filter out falsy values (false, null, undefined) — standard Vite convention for conditional plugins
  • Deduplication by .name works correctly for all plugin types

Test Plan

Added unit tests in packages/appkit/src/utils/tests/vite-config-merge.test.ts covering:

  • Deduplication of single plugins by name
  • Flattening array-returning plugins
  • Deduplication across flattened array plugins and single plugins
  • Deeply nested plugin arrays
  • Filtering out falsy plugin entries
  • Mixed falsy and valid plugins

Manual Testing

  • Built and used the local version of appkit to make sure this fixed the issue

pffigueiredo and others added 3 commits February 6, 2026 14:35
Flatten nested arrays and filter falsy values before deduplicating,
matching Vite's own PluginOption handling. Fixes crash with plugins
like @tailwindcss/vite that return Plugin[].

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Pedro Figueiredo <[email protected]>
@pffigueiredo pffigueiredo self-assigned this Feb 6, 2026
@pkosiec
Copy link
Member

pkosiec commented Feb 10, 2026

@MarioCadenas please take a look, as I'm not sure if this doesn't conflict with your changes in the plugins area?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants