Skip to content

Better target for bundlecheck #500

Closed

Description

@aversini

The package bundlechek is hard coding the esbuild target to 2020.

This feature request has 2 goals:

  • replace this with 2022
  • add an option (both for CLI and API) to allow the user to override this new default.
  • the PR subject should start with "feat(bundlecheck): "

Activity

  1. aversini commented on Feb 4, 2026

    @aversini
    CollaboratorAuthor

    @cursor fix please

  2. cursor commented on Feb 4, 2026

    @cursor

    I've successfully implemented the requested feature. Here's a summary of the changes:

    Changes made:

    1. Updated default esbuild target from es2020 to es2022 in bundler.ts

    2. Added new target option for both CLI and API:

      • CLI: --target/-T flag (e.g., bundlecheck lodash --target es2020)
      • API: target option in getBundleStats() and getBundleTrend() functions
    3. Files modified:

      • defaults.ts - Added DEFAULT_TARGET, VALID_TARGETS, isValidTarget(), and normalizeTarget() functions
      • bundler.ts - Added target to BundleOptions type and used it in esbuild calls
      • parse.ts - Added CLI flag definition and validation
      • bundlecheck.ts - Pass target to bundle functions
      • index.ts - Added target to API types and functions
      • trend.ts - Added target support for trend analysis
      • README.md - Documented the new option
      • defaults.test.ts - Added unit tests for target validation
    4. Valid target values: es2015 through es2024 and esnext

    All 187 tests passed (including 11 new tests for target validation). The commit has been pushed to the cursor/bundlecheck-esbuild-target-3e3e branch.

    View PR

    Open in Cursor Open in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions