Run the plugin under Vite+: `vite` alias, peer dependency, and a CI job

Open
#15 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
github-actions, typescript, vite

Research direction

Read the Vite+ page, status.md, docs/decisions.md, and ci.yml, then inspect the playground scripts and existing CI jobs. Validate the listed Vite+ scenarios, including SSR, i18n builds, extraction, and type checks; decide how to handle the peer dependency and playground formatting. Done means a pinned Vite+ CI job covers the requested commands and fetch, and the outcomes and decision are recorded in both docs.

Written by the indexing model from the issue text.

Description

feature

Part of #13. Labels: feature.

The problem

The plugin imports from vite (createFilter, parseSync, createBuilder, parseAstAsync, and types) and declares peerDependencies.vite: ^8.3.0. A Vite+ project depends on vite-plus, and gets vite only as the alias vite: npm:@voidzero-dev/vite-plus-core@<version> that vp migrate writes when vite was already declared. Two consequences, both reproduced with [email protected] and the plugin at 0.2.0:

  1. A project with vite-plus and no vite entry: vp build fails to load the plugin (no vite in node_modules).
  2. A project with the alias: everything works (vp dev, vp build, vp test, vp check), but the alias reports version 1.5.0, so npm and yarn warn about the unmet ^8.3.0 peer, and pnpm only stays quiet because the migration adds peerDependencyRules.allowAny: [vite].

What to decide

  • Keep importing from vite and document the alias, the minimal change. Costs a peer warning on npm/yarn and one line in the docs. Or
  • Widen the peer range to admit the alias, e.g. "vite": "^8.3.0 || npm:@voidzero-dev/vite-plus-core@*" (check what npm/pnpm accept for an aliased peer; it may need peerDependenciesMeta.vite.optional: true plus a clear runtime error). Or
  • Resolve vite at runtime: try vite, then vite-plus (which re-exports defineConfig, lazyPlugins, defineProject, resolveConfigFromFile only, so the helpers would still need @voidzero-dev/vite-plus-core). Most code, least warnings.

Recommendation: the first for now, documented in the Vite+ page and in status.md, and revisit when Vite+ documents a stable way for plugins to reach Vite's API.

CI

Add a vite-plus job to ci.yml that installs vite-plus at a pinned version (bump it like any dependency), then on the playground runs vp build, vp test run, starts vp dev and fetches a compiled component, and runs vp check (with --fix first if the playground isn't Oxfmt-formatted; decide whether the playground adopts Oxfmt or the job only checks lint and types). The playground keeps vite so it works both ways; it should not be migrated to Vite+ itself, so the repo's own tooling stays as it is.

Also check

  • ngp({ssr: true}) under vp dev and vp build (the SSR middleware and the ssr environment optimizer).
  • ngp-extract-i18n under vpx (vp migrate offers to move tsx scripts to vpx).
  • The i18n option's per-locale build under vp build.
  • Type-checking: vp check runs tsgo over the project and the plugin runs its own TypeScript 7 check in vp build; the two agree on the spike. Document that vp check doesn't check templates, the plugin does.

Record the outcome in status.md ("Vite+" row) and docs/decisions.md.

Dominant language
TypeScript
Stars
7
Forks
1
Avg merge
12h 24m
Merged PRs (30d)
13

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from push-based/vite-plugin-ngp

All issues in push-based/vite-plugin-ngp

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.