Skip to content

fix(pack): bundle @tsdown/exe and @tsdown/css into core#1919

Open
fengmk2 wants to merge 8 commits into
mainfrom
fix/bundle-tsdown-exe-css
Open

fix(pack): bundle @tsdown/exe and @tsdown/css into core#1919
fengmk2 wants to merge 8 commits into
mainfrom
fix/bundle-tsdown-exe-css

Conversation

@fengmk2

@fengmk2 fengmk2 commented Jun 23, 2026

Copy link
Copy Markdown
Member

Problem

@tsdown/exe and @tsdown/css hard-peer-depend on tsdown and import tsdown/internal, but Vite+ bundles tsdown internally with no resolvable top-level tsdown package. Installing them at the project level fails with Failed to import module "@tsdown/exe" (and the equivalent for CSS bundling).

Fix

Bundle both extensions into core (tsdown-exe.js, tsdown-css.js) so tsdown/internal resolves at build time and vp pack --exe / CSS bundling work with no extra install. lightningcss (native, cannot be bundled) becomes an optional peer, loaded lazily with an actionable error when it is missing.

Tests

  • command-pack-css: CSS transforms run through the bundled @tsdown/css + lightningcss.
  • command-pack-tsdown-extensions: the bundled exe/css chunks load without a top-level tsdown.

Closes #1586

@fengmk2 fengmk2 self-assigned this Jun 23, 2026
@netlify

netlify Bot commented Jun 23, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview ready!

Name Link
🔨 Latest commit 12560ea
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a3a824a97d02c0008ecd992
😎 Deploy Preview https://deploy-preview-1919--viteplus-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

✅ Staging deployment successful!

Preview: https://viteplus-staging.void.app/
Commit: 12560ea

Comment thread docs/guide/pack.md Outdated
@pkg-pr-new

pkg-pr-new Bot commented Jun 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

vite-plus

npm i https://pkg.pr.new/voidzero-dev/vite-plus@1919

@voidzero-dev/vite-plus-core

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-core@1919

@voidzero-dev/vite-plus-prompts

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-prompts@1919

@voidzero-dev/vite-plus-cli-darwin-arm64

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-darwin-arm64@1919

@voidzero-dev/vite-plus-cli-darwin-x64

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-darwin-x64@1919

@voidzero-dev/vite-plus-cli-linux-arm64-gnu

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-linux-arm64-gnu@1919

@voidzero-dev/vite-plus-cli-linux-arm64-musl

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-linux-arm64-musl@1919

@voidzero-dev/vite-plus-cli-linux-x64-gnu

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-linux-x64-gnu@1919

@voidzero-dev/vite-plus-cli-linux-x64-musl

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-linux-x64-musl@1919

@voidzero-dev/vite-plus-cli-win32-arm64-msvc

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-win32-arm64-msvc@1919

@voidzero-dev/vite-plus-cli-win32-x64-msvc

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-cli-win32-x64-msvc@1919

@voidzero-dev/vite-plus-darwin-arm64

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-darwin-arm64@1919

@voidzero-dev/vite-plus-darwin-x64

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-darwin-x64@1919

@voidzero-dev/vite-plus-linux-arm64-gnu

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-linux-arm64-gnu@1919

@voidzero-dev/vite-plus-linux-arm64-musl

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-linux-arm64-musl@1919

@voidzero-dev/vite-plus-linux-x64-gnu

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-linux-x64-gnu@1919

@voidzero-dev/vite-plus-linux-x64-musl

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-linux-x64-musl@1919

@voidzero-dev/vite-plus-win32-arm64-msvc

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-win32-arm64-msvc@1919

@voidzero-dev/vite-plus-win32-x64-msvc

npm i https://pkg.pr.new/voidzero-dev/vite-plus/@voidzero-dev/vite-plus-win32-x64-msvc@1919

commit: 44bdb72

fengmk2 added 5 commits June 23, 2026 17:05
@tsdown/exe and @tsdown/css hard-peer-depend on tsdown and import
tsdown/internal, but Vite+ bundles tsdown internally with no resolvable
top-level tsdown package, so installing them failed with "Failed to
import module @tsdown/exe".

Bundle both into core (tsdown-exe.js, tsdown-css.js) so they resolve
tsdown/internal at build time and work without any extra install.
lightningcss (native) stays external as an optional peer, loaded lazily
with an actionable error when it is missing.

Closes #1586
Add the command-pack-css-missing-lightningcss snap test: a resolve hook
makes lightningcss unresolvable (the dev/CI monorepo always has it), so
vp pack surfaces the actionable install hint. Locks in that the error
tells users how to fix it.
…sdown

They are bundled into core and exact-peer-depend on the same tsdown
version, so the catalog entries must track tsdown on every upgrade run.
…al peer

lightningcss is already a core dependency (Vite's lightningcss transformer
uses it), so the bundled @tsdown/css can use it directly and CSS bundling
works with no extra install. Revert the optional-peer + loader churn: keep
lightningcss in dependencies (via catalog) and drop the
__vpImportLightningcss helper and the missing-lightningcss snap test.
…xtensions in Renovate

lightningcss is a core dependency consumed by the bundled @tsdown/css, so
upgrade-deps now mirrors @tsdown/css's lightningcss range into the catalog
when bumping tsdown. Also ignore @tsdown/css, @tsdown/exe and lightningcss
in Renovate so they stay in lockstep with tsdown instead of drifting.
@fengmk2 fengmk2 added test: e2e Auto run e2e tests test: install-e2e run vite install e2e test test: create-e2e Run `vp create` e2e tests labels Jun 23, 2026
@fengmk2 fengmk2 force-pushed the fix/bundle-tsdown-exe-css branch from 44bdb72 to e107015 Compare June 23, 2026 09:06
fengmk2 added 3 commits June 23, 2026 20:35
- wireBundledTsdownExtensions: scan every emitted chunk (not just
  build-*.js) and assert the bundled ./tsdown-css.js is referenced, so a
  rolldown chunking change can't silently ship an unrewritten import.
- upgrade-deps: match any lightningcss range value so a non-caret range
  from @tsdown/css can't poison the next run's pattern.
- rfc: lightningcss is a core dependency, not an optional peer.
getLatestNpmVersion and getNpmDependencyRange duplicated the same
registry fetch + ok-check + json block; extract fetchNpmLatest so the
registry URL and error wording live in one place.
Node 26 is the version the exe targets default to and clears the 25.7
SEA floor; `vp env use 25` could resolve below it.
@fengmk2

fengmk2 commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 12560ea350

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@fengmk2 fengmk2 marked this pull request as ready for review June 23, 2026 13:22
@fengmk2

fengmk2 commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

cc @sxzz

@fengmk2 fengmk2 requested a review from cpojer June 23, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg.pr.new test: create-e2e Run `vp create` e2e tests test: e2e Auto run e2e tests test: install-e2e run vite install e2e test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vp pack --exe fails with "Failed to import module @tsdown/exe" when @tsdown/exe is installed as documented

3 participants