fix(plugin): prevent raw .ts import crash when esbuild transpilation fails#503
Merged
jackwener merged 1 commit intojackwener:mainfrom Mar 27, 2026
Merged
Conversation
…fails (jackwener#500) When a TS plugin is installed but esbuild is unavailable or transpilation fails silently, the plugin discovery would attempt to import() the raw .ts file, causing 'Unknown file extension .ts' on production Node.js. Changes: - discovery.ts: Skip raw .ts import when no compiled .js exists; show an actionable warning guiding the user to re-transpile or install esbuild - plugin.ts: Upgrade esbuild-not-found from debug to warn level; log the outer catch error instead of silently swallowing it Closes jackwener#500
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.
Problem
Fixes #500
When a TS plugin is installed but esbuild is unavailable or transpilation fails silently, the plugin discovery attempts to
import()the raw.tsfile at runtime, causing:Root Cause
transpilePluginTs()silently swallows all errors (barecatch {}), so if esbuild isn't available, no.jsfile is generated and no warning is showndiscoverPluginDir()sees the.tsfile with no.jscompanion and attempts directimport(), which fails on production Node.js (only works undertsxin dev mode)Changes
src/discovery.ts.tsplugin file has no compiled.jscompanion, skip the import and show an actionable warning:Plugin hot-digest/aggregate.ts: no compiled .js found. Run "opencli plugin update hot-digest" to re-transpile, or install esbuild.src/plugin.tslog.debug→log.warnso users know TS plugins won't workTesting
.jsfrom hot-digest plugin now shows a clear warning instead of crashing