Skip to content

fix: skip runtime rebuild when esbuild is omitted - #8

Open
shyn wants to merge 1 commit into
Michaelliv:mainfrom
shyn:fix/prepare-skip-missing-esbuild
Open

shyn wants to merge 1 commit into
Michaelliv:mainfrom
shyn:fix/prepare-skip-missing-esbuild

Conversation

@shyn

@shyn shyn commented Aug 31, 2026

Copy link
Copy Markdown

Problem

pi install / pi update of this git package runs npm install --omit=dev. That skips esbuild (a devDependency) but still runs preparebuild:runtime, which imported esbuild unconditionally:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'esbuild' imported from
  .../pi-generative-ui/.pi/extensions/generative-ui/build.mjs
Error: npm install --omit=dev failed with code 1

The page-side bundle is already committed (runtime.bundle.ts), and the README says end users should not need a build step.

Fix

If esbuild is not installed and runtime.bundle.ts already exists, skip the rebuild. Developers with a full install still regenerate the bundle as before. A missing bundle without esbuild still fails loudly.

This is an alternative to #6 (moving esbuild into dependencies). Shipping esbuild to every consumer is unnecessary when the committed bundle is the artifact they actually use.

Tested

npm install --omit=dev
# prepare: esbuild not installed; using committed runtime.bundle.ts
# exit 0

pi install/update of git packages runs `npm install --omit=dev`, which
skips esbuild (a devDependency) but still runs the prepare script.
prepare imported esbuild unconditionally, so installs failed even though
runtime.bundle.ts is already committed.

Skip the rebuild when esbuild is missing and the committed bundle exists.
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.

1 participant