Skip to content

fix: pass explicit include globs to rollup-plugin-typescript2#906

Merged
JohnMcLear merged 1 commit intomainfrom
fix/rollup-typescript-include
Apr 7, 2026
Merged

fix: pass explicit include globs to rollup-plugin-typescript2#906
JohnMcLear merged 1 commit intomainfrom
fix/rollup-typescript-include

Conversation

@JohnMcLear
Copy link
Copy Markdown
Member

Summary

  • `rollup-plugin-typescript2@0.36` depends on `@rollup/pluginutils@^4.1.2`, whose picomatch build does not support extglobs.
  • Its default `include` is `*.ts+(|x)` — under pluginutils@4 that matches nothing, so every `.ts` file is silently skipped, rollup parses `index.ts` as raw JS, and dies at line 42 (`type CBDBType = {`).
  • Pass an explicit non-extglob `include` so the filter actually matches.

PR #905 fixed the tsconfig `include` list but the plugin-side filter was the real culprit, so CI publish kept failing on the exact same line.

Reproduced in a clean clone of `main` and verified the fix builds.

Test plan

  • `rm -rf dist && pnpm run build` succeeds in a clean clone
  • CI publish job on `main` goes green after merge

🤖 Generated with Claude Code

rollup-plugin-typescript2@0.36 depends on @rollup/pluginutils@^4.1.2,
whose picomatch build does not support extglobs. Its default include
pattern is `*.ts+(|x)` — under pluginutils@4 that pattern matches
nothing, so the plugin silently skips every .ts file in the project.
rollup then falls back to parsing index.ts as raw JavaScript and dies
on the first `type` declaration:

  RollupError: index.ts (42:5): Expected ';', '}' or <eof>

Pass an explicit non-extglob include so the filter actually matches.

The previous attempt (PR #905) fixed the tsconfig include list but did
not address the plugin-side filter, so CI publish kept failing on
exactly the same line.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Fix rollup-plugin-typescript2 include glob pattern for pluginutils@4

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Fix TypeScript plugin include glob pattern incompatibility
• Explicitly specify include/exclude globs for rollup-plugin-typescript2
• Resolve picomatch extglob support limitation in @rollup/pluginutils@4
• Prevent silent .ts file skipping causing build failures
Diagram
flowchart LR
  A["rollup-plugin-typescript2@0.36"] -->|depends on| B["@rollup/pluginutils@4"]
  B -->|picomatch limitation| C["Extglobs not supported"]
  C -->|causes| D["Default pattern fails"]
  D -->|results in| E["TypeScript files skipped"]
  E -->|leads to| F["Build error at type declaration"]
  G["Explicit include/exclude globs"] -->|fixes| F
Loading

Grey Divider

File Changes

1. rollup.config.cjs.js 🐞 Bug fix +7/-0

Add explicit include/exclude globs to typescript plugin config

• Added explicit include array with patterns ['*.ts', '**/*.ts'] to match TypeScript files
• Added explicit exclude array with patterns ['*.d.ts', '**/*.d.ts'] to exclude declaration
 files
• Added detailed comment explaining the picomatch extglob limitation and why explicit globs are
 needed
• Ensures rollup-plugin-typescript2 properly filters TypeScript files instead of silently skipping
 them

rollup.config.cjs.js


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Review Summary by Qodo

Fix rollup-plugin-typescript2 include glob pattern compatibility

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• Fix TypeScript plugin include glob pattern incompatibility
• Explicitly pass non-extglob patterns to rollup-plugin-typescript2
• Resolve silent .ts file skipping causing build failures
• Add exclude pattern for .d.ts declaration files
Diagram
flowchart LR
  A["rollup-plugin-typescript2@0.36"] -->|depends on| B["@rollup/pluginutils@4"]
  B -->|picomatch no extglobs| C["Default pattern fails"]
  C -->|silently skips| D[".ts files"]
  D -->|fallback to raw JS| E["Build crashes"]
  F["Explicit include globs"] -->|replaces| C
  F -->|enables matching| D
  D -->|TypeScript parsing| G["Build succeeds"]
Loading

Grey Divider

File Changes

1. rollup.config.cjs.js 🐞 Bug fix +7/-0

Add explicit include/exclude globs to TypeScript plugin

• Added explicit include array with non-extglob patterns (*.ts, **/*.ts)
• Added explicit exclude array for declaration files (*.d.ts, **/*.d.ts)
• Added detailed comment explaining the picomatch extglob incompatibility issue
• Prevents silent .ts file skipping that caused TypeScript parsing errors

rollup.config.cjs.js


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

qodo-free-for-open-source-projects bot commented Apr 7, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review bot commented Apr 7, 2026

Code Review by Qodo

🐞 Bugs (1)   📘 Rule violations (0)   📎 Requirement gaps (0)   🎨 UX Issues (0)
🐞\ ⚙ Maintainability (1)

Grey Divider


Advisory comments

1. TSX not included 🐞
Description
The new Rollup TypeScript filter only matches ".ts" even though the comment documents the plugin’s
original default intent to match both ".ts" and ".tsx" (via *.ts+(|x)). If this package later adds
TSX sources, they will not be picked up by the plugin unless the include globs are extended.
Code

rollup.config.cjs.js[R15-21]

+      // rollup-plugin-typescript2@0.36 depends on @rollup/pluginutils@4,
+      // whose picomatch doesn't support extglobs — so the plugin's default
+      // include pattern (`*.ts+(|x)`) silently matches nothing and every
+      // .ts file is skipped, leaving rollup to parse raw TypeScript and
+      // crash. Pass explicit globs that pluginutils@4 can handle.
+      include: ['*.ts', '**/*.ts'],
+      exclude: ['*.d.ts', '**/*.d.ts'],
Evidence
The config comment explicitly references the previous default include pattern *.ts+(|x) (which
covers .ts and .tsx), but the new explicit include list only contains patterns ending in .ts.

rollup.config.cjs.js[13-22]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`rollup-plugin-typescript2` was previously intended (per the comment) to include both `.ts` and `.tsx` via the default extglob `*.ts+(|x)`. The new explicit `include` only matches `.ts`, so TSX sources won’t be processed if introduced.

### Issue Context
You’re replacing the broken extglob with explicit globs that @rollup/pluginutils@4 can handle.

### Fix Focus Areas
- rollup.config.cjs.js[15-21]

### Suggested change
Extend `include` to also match TSX using non-extglob patterns, e.g.:
- `include: ['*.ts', '*.tsx', '**/*.ts', '**/*.tsx']`

(Optionally, keep `exclude` aligned with any declaration variants you care about, such as `.d.mts`/`.d.cts`, if relevant.)

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@JohnMcLear JohnMcLear merged commit 04d2ee1 into main Apr 7, 2026
11 checks passed
@JohnMcLear JohnMcLear deleted the fix/rollup-typescript-include branch April 7, 2026 22:33
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