Skip to content
This repository was archived by the owner on Jun 25, 2026. It is now read-only.

fix(build): repair esbuild TS include so commons .ts transpiles (unblocks CI build)#478

Draft
maithri471 wants to merge 3 commits into
mainfrom
fix/rollup-esbuild-ts-include
Draft

fix(build): repair esbuild TS include so commons .ts transpiles (unblocks CI build)#478
maithri471 wants to merge 3 commits into
mainfrom
fix/rollup-esbuild-ts-include

Conversation

@maithri471

Copy link
Copy Markdown
Contributor

Problem

Now that #477 unblocked the CI build job (it bumped the hard-deprecated actions/cache@v2 → v4), build actually reaches yarn build — and fails repo-wide:

@nylas/components-booking: ../../commons/src/define-component-patch.ts (4:36)
4: window.customElements.define = (name: string, ...args) => {
                                        ^
[!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)

main is red and this blocks every PR.

Root cause

rollup.common.config.js gates esbuild's TypeScript transpile with a glob:

esbuild({ include: [`${ROOT}/**/*.ts+(|x)`], ... })

That +(|x) extglob no longer matches .ts files under picomatch 4.x. The repo ships a yarn.lock, but CI installs with npm install, which ignores yarn.lock — so picomatch floats to 4.x and esbuild silently stops transpiling all TypeScript. Every component build then dies on the first raw .ts import (commons/src/define-component-patch.ts). It stayed hidden because CI's build job used to die at the actions/cache@v2 setup gate before yarn build ever ran.

Fix

Replace the fragile, cwd-/picomatch-dependent glob with a regex:

esbuild({ include: /\.tsx?$/, ... })

Verification

Reproduced and fixed with the repo's exact plugin versions ([email protected], [email protected]) against the real offending file:

  • old include: ['**/*.ts+(|x)']Unexpected token (bug reproduced)
  • new include: /\.tsx?$/ → clean build; output transpiled (name: stringname)

Also confirmed at the filter layer: createFilter(['../../**/*.ts+(|x)']) returns false for the commons .ts file; the regex returns true. Final end-to-end check is this PR's CI run (Linux + node 14, where node-sass compiles — it won't build on macOS locally).

Follow-ups (separate)

  • Align lockfile/CI — the root fragility is yarn.lock + npm install. Use yarn install --frozen-lockfile (or commit package-lock.json + npm ci) so transitive deps can't drift like this again.
  • Soft-deprecated actions/checkout@v2, actions/setup-node@v2, ::set-output in the workflow.

🤖 Generated with Claude Code

The shared rollup.common.config esbuild plugin gated TS transpilation on the
glob `${ROOT}/**/*.ts+(|x)`. That extglob no longer matches .ts files under
picomatch 4.x, and CI runs `npm install` (which ignores our yarn.lock), so
picomatch floats to 4.x. esbuild therefore silently stopped transpiling
TypeScript and every component build failed on the first raw .ts import
(commons/src/define-component-patch.ts -> "Unexpected token ... need plugins
to import files that are not JavaScript").

Replace the fragile glob with a cwd/picomatch-independent regex /\.tsx?$/.

Verified with the repo's exact plugin versions ([email protected],
[email protected]): the old glob reproduces the error, the regex transpiles
cleanly. This was masked for a long time because CI's build job died at the
deprecated actions/cache@v2 setup gate before ever running `yarn build`.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
components Error Error Jun 22, 2026 7:30pm
components-pnmt Error Error Jun 22, 2026 7:30pm

Request Review

These jobs had no checkout step and pulled the entire workspace from the
build job via actions/cache (path: ./*). That cross-job handoff broke after
the mandatory cache@v2 -> v4 migration (the v2 backend was shut down): the
restore misses, so the jobs run against an empty workspace and fail fast with
`npm ERR! enoent ... package.json`.

Give each job its own actions/checkout@v4 + npm install (matching the build
job) so it no longer depends on the fragile cache handoff.

Note: test-cypress uses the same handoff but also needs the built app to
serve; left for a separate change.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… build)

These jobs now check out and install on their own, so they no longer need
build's output. `needs: build` only made them idle ~22 min waiting for the
build to finish before starting. Dropping it lets them run immediately in
parallel, cutting feedback time from ~25 min to ~5-6 min.

publish still gates on all four jobs via its own needs list; test-cypress
keeps needs: build (it serves the built app).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant