Ergonomics of vp pack + plugins
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- build-system, tooling
Rechercherichtung
Beginne mit dem von vp pack verwendeten Pfad zur Konfigurationsextraktion und dem durch VP_RESOLVING_CONFIG_METADATA gesteuerten Verhalten von lazyPlugins; das Issue enthält eine Reproduktion in vite.config.ts. Führe vp pack mit dem bereitgestellten Plugin aus und verfolge, wie root und pack.plugins an tsdown weitergeleitet werden. Erledigt ist es, wenn Pack-Plugins ausgeführt werden, während sie für vp lint und vp fmt lazy bleiben, und die Zusammensetzung der Root-Plugins geklärt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Description
Configuring plugins for library packaging via vp pack has confusing ergonomics and a potential bug when using lazyPlugins:
- Root
pluginsare ignored byvp pack: In a library project usingvite.config.ts, plugins configured at the root (plugins: [...]) are not forwarded totsdownduringvp pack. Users must define them redundantly underpack.plugins. lazyPluginsfails silently insidepack.plugins: If a user attempts to wrappack.pluginsinlazyPlugins(() => [...])to avoid running plugin factories duringvp lintorvp fmt, the plugins never execute duringvp pack.
Root Cause
When vp pack extracts the tsdown config from vite.config.ts, VP_RESOLVING_CONFIG_METADATA is set to "1".
Inside lazyPlugins:
function lazyPlugins(cb) {
if (process.env["VP_RESOLVING_CONFIG_METADATA"] === "1") return;
const result = cb();
return result;
}
Because the metadata environment marker is active during config extraction for vp pack, lazyPlugins returns undefined. Consequently, tsdown runs with no plugins.
Reproduction
In vite.config.ts:
import { defineConfig, lazyPlugins } from 'vite-plus';
function myPlugin() {
return {
name: 'test-plugin',
buildStart() {
console.log('--- PLUGIN EXECUTED ---');
},
};
}
export default defineConfig({
pack: {
entry: ['src/index.ts'],
// ❌ Fails: '--- PLUGIN EXECUTED ---' is never printed
plugins: lazyPlugins(() => [myPlugin()]),
// ⚠️ Works, but runs eagerly during `vp lint` / `vp fmt`:
// plugins: [myPlugin()],
},
// ❌ Ignored by `vp pack`:
// plugins: [myPlugin()],
});
Run:
vp pack
Suggested solution
lazyPluginsshould evaluate when resolving the build pipeline forvp pack, so plugins can be lazily loaded without executing duringvp check/vp fmt/vp lint.- Ideally, plugins defined at the root (
plugins: [...]) should either auto merge withpack.pluginsby default when building libraries, or vite-plus should provide clear ergonomics/typing on how root Vite plugins vs. pack plugins compose. It's frankly confusing having two separate places to specify the plugin arrays.
Alternative
No response
Additional context
No response
Validations
- Read the Contributing Guidelines.
- Confirm this request is for Vite+ itself and not for Vite, Vitest, tsdown, Rolldown, or Oxc.
- Check that there isn't already an issue requesting the same feature.
- Vorherrschende Sprache
- Rust
- Sterne
- 6.5k
- Forks
- 297
- Ø Merge
- 20 Std. 18 Min.
- Gemergte PRs (30 T.)
- 236
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus voidzero-dev/vite-plus
-
triage: not actionable
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
voidzero-dev/vite-plus#3296 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
pending triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 63/100
voidzero-dev/vite-plus#3235 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Docker guide: the runtime stage needs libatomic1 for Node.js 25 and laterEvtl. vergeben @kshanxs hat das vor 9 Tagen übernommen. Offendocumentation
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
voidzero-dev/vite-plus#3219 · 2 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
pending triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
voidzero-dev/vite-plus#2882 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Upgrade Upstream Dependencies timed outEvtl. vergeben @fengmk2 hat das vor 1 Tag übernommen. Offenupgrade-deps-timeout
voidzero-dev/vite-plus#3319 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in voidzero-dev/vite-plus
Ähnliche Issues
-
docs(metrics): replace stale src/metrics.rs line anchors in dashboard-metrics.md with symbol namesOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
Maintainer antworten meist innerhalb von 1 Tag
-
ci-cd desktop size:low telemetry-improvement telemetry-round-1
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
vfarcic/dot-agent-deck#2079 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement user-priority/P3
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
t8y2/dbx#14196 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
Maintainer antworten meist innerhalb von 2 Tagen