Skip to content

Change Request: Stop rolling up package #374

@nzakas

Description

@nzakas
Member

Environment

HEAD

What problem do you want to solve?

Right now, we're rolling up the files in this package for distribution, we requires us cleaning up duplicate type definitions. This is a lot of work and we're stuck with how we can reference types between files due to these limitations.

What do you think is the correct solution?

Stop rolling up the package. This isn't strictly necessary because it's an ESM-only package, and therefore, we're not getting much extra value from rolling things up.

We can remove Rollup and just have tsc emit both types and code to the dist directory. The end result for plugin users will be the same and it will allow us more flexibility with how we import and define types.

Participation

  • I am willing to submit a pull request for this change.

Additional comments

No response

Activity

xbinaryx

xbinaryx commented on May 13, 2025

@xbinaryx
Contributor

I'll look into this if there is consensus within the team.

moved this from Needs Triage to Triaging in Triageon May 14, 2025
lumirlumir

lumirlumir commented on May 14, 2025

@lumirlumir
Member

I believe this issue aligns with the one I’ve been working on: #367.

While the combination of rollup and dudupe-types is nice, but it introduces unnecessary complexity when working with types.

If this is accepted, it will make the ongoing migration to the @import syntax (#367) much easier.

So, 👍 to this! Let’s move forward.


But one thing I’m afraid of is: wouldn’t this be a breaking change?

nzakas

nzakas commented on May 14, 2025

@nzakas
MemberAuthor

But one thing I’m afraid of is: wouldn’t this be a breaking change?

I don't think so. What is it you think would break?

lumirlumir

lumirlumir commented on May 15, 2025

@lumirlumir
Member

I'm just wondering —

If we remove rollup and rely only on tsc emit, is it still possible to put all type declarations into a single file like index.d.ts, as we did before?

Does the automatically generated index.d.ts file emitted by tsc include all type information like before?

nzakas

nzakas commented on May 15, 2025

@nzakas
MemberAuthor

When doing this with tsc, it will generate an index.d.ts file to go along with the index.js file. There will also be .d.ts files for each individual file, and index.d.ts will import the other .d.ts files as needed.

For a package user, this change is transparent.

lumirlumir

lumirlumir commented on May 16, 2025

@lumirlumir
Member

Thank you for the explanation.

In that case, I suppose there won’t be any issues if we stop bundling the packages. 👍

fasttime

fasttime commented on May 20, 2025

@fasttime
Member

Sounds good to remove the Rollup bundling step to simplify the build process. +1 from me.

mdjermanovic

mdjermanovic commented on May 20, 2025

@mdjermanovic
Member

Sounds good to me too 👍

snitin315

snitin315 commented on May 20, 2025

@snitin315
Contributor

Marking this as accepted. @xbinaryx Would you like to send a PR?

moved this from Triaging to Ready to Implement in Triageon May 20, 2025
moved this from Ready to Implement to Implementing in Triageon May 21, 2025
tats-u

tats-u commented on Jun 4, 2025

@tats-u

How about tsup, tsdown, or rslib?

lumirlumir

lumirlumir commented on Jun 4, 2025

@lumirlumir
Member

How about tsup, tsdown, or rslib?

@tats-u Thanks for your suggestion. — Just to clarify, though, this is more about removing the bundling system from the build process entirely, rather than migrating to a different one 😄

tats-u

tats-u commented on Jun 5, 2025

@tats-u

tsdown and rslib can generate .d.ts more quickly than tsc by omitting type check.
I think you want to do a type check when generating dts and only tsc is fine.
We can adopt the Go-powered tsc in the future if you feel tsc is too slow.

nzakas

nzakas commented on Jun 5, 2025

@nzakas
MemberAuthor

@tats-u performance isn't a consideration here. This script runs only when the package is built during a release.

moved this from Implementing to Complete in Triageon Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @nzakas@fasttime@tats-u@mdjermanovic@snitin315

    Issue actions

      Change Request: Stop rolling up package · Issue #374 · eslint/markdown