Skip to content

🚀 Feature: Rethinking building: entry points, bundle: false, and tsup issues #1910

Open
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Bug Report Checklist

Overview

Coming over and recapping from JoshuaKGoldberg/eslint-fix-utils#7 -> JoshuaKGoldberg/eslint-fix-utils#13: CTA right now uses tsup for production builds. tsup is a pretty darn good wrapper around esbuild. It was originally added to CTA in #623 -> #640 to avoid transpiling test files such as *.test.*.

tsup is configured at the moment with a couple opinionated settings:

  • bundle: false: I prefer having output lib/ files match the structure in src/ for a few reasons:
    • Development: faster incremental rebuilds, especially in larger packages
    • Production: IMO it's easier to debug node_modules/ contents when the structure matches
  • entry: ["src/**/*.ts", "!src/**/*.test.*"]: since there isn't bundling, the full list of files to build needs to be told to tsup

We've also started to see some issues with tsup falling out of maintenance a bit (💔 - sustained open source maintenance is hard and taxing!):

I think there are two root issues here:

  • tsup is build on a bundler, esbuild, and is tailored to the bundling use case. The file-by-file transpilation use case is not as emphasized.
  • tsup is not being maintained at a level needed to match its growing userbase.

Therefore, I think it would make sense to think critically about how CTA packages build lib/ output. Is there a tool that can satisfy all the desired needs?

  • File-by-file transpilation
  • Tree-shaking based on entry points, not hardcoded heuristics like *.test.*
  • Quick JS output (read: not waiting on type checking to output JS files)
  • Full .d.ts output (read: not being limited to just what's supported in isolatedDeclarations)

If not, I shudder to think I might have to build one. 😬

Additional Info

The fact that tsup exists & works at all is awesome. I don't mean to file this issue judgementally. https://xkcd.com/2347, https://nolanlawson.com/2017/03/05/what-it-feels-like-to-be-an-open-source-maintainer etc. etc. This is a pragmatic issue: tsup isn't completely able to do what CTA needs right now and so we need to evaluate what's best for the project.

Edit: see also https://bsky.app/profile/joshuakgoldberg.com/post/3lhgppvnyjc2e for links to other projects

🎁

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: in discussionNot yet ready for implementation or a pull requesttype: featureNew enhancement or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions