Repository navigation
fix(vite): apply plugins from dependency nativescript.vite.mjs configs - #11669
Merged
Merged
Conversation
Vite ignores `plugins` returned from a `config` hook, so plugins shipped by a dependency's nativescript.vite.mjs were silently dropped while the rest of its config (aliases, define, ...) applied. externalConfigsPlugin() now returns two plugin entries sharing one cached discovery: the config-hook plugin merges each external config without its `plugins`, and a lazy thenable entry resolves to those plugins, which Vite awaits and flattens into the plugin list.
|
View your CI Pipeline Execution ↗ for commit 99efcf3
💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dependencies can ship a
nativescript.vite.mjsthat@nativescript/vitemerges into the build. Anypluginsthey returned were silently dropped. The rest of the config (aliases,define, …) still applied.Cause:
externalConfigsPlugin()merged those configs from aconfighook, and Vite ignorespluginsreturned fromconfig.Fix:
externalConfigsPlugin()now returns two entries that share one cached discovery.confighook merges each external config with itspluginsremoved.Discovery still runs at most once per process, and only when Vite resolves the config. The ESM
import()fallback for configs with top-level await is unchanged.Found with
@nativescript/tanstack-router. ItstanstackRouter()plugin never ran, sorouteTree.gen.tswas never regenerated, while its@solidjs/webalias did apply.Tests
external-configs.spec.ts:confighook result has nopluginskey and still appliesdefine.resolveConfig(...).plugins, and its hook runs.The first two tests fail without the fix. The full
packages/vitesuite passes (1965 tests), andnx build vitesucceeds.