Skip to content

build: migrate bundle pipeline to tsdown #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

TheAlexLichter
Copy link

As tsup is not actively maintained anymore and there are faster tools as drop-in replacement available (based on Rolldown), I took a few minutes to migrate the packages over to tsdown.

This should yield in faster builds (bundling and speedy DTS generation).

PS: Sorry for the drive-by PR!

@TheAlexLichter TheAlexLichter requested review from a team as code owners June 11, 2025 15:08
@serhalp serhalp added the type: chore work needed to keep the product and development running smoothly label Jun 18, 2025
@serhalp serhalp marked this pull request as draft June 18, 2025 22:43
@TheAlexLichter TheAlexLichter marked this pull request as ready for review June 21, 2025 21:08
@TheAlexLichter
Copy link
Author

TheAlexLichter commented Jun 21, 2025

Issues are fixed & tests run locally as expected 👍🏻 (cc @serhalp)

@serhalp
Copy link
Member

serhalp commented Jul 22, 2025

sorry for the delays on this one @TheAlexLichter. If you can give this one more update we'll get it merged! Thanks for the PR! 😄

@TheAlexLichter
Copy link
Author

@serhalp No worries! Updated, build + tests passing locally. (Lint errors are from main)

@serhalp
Copy link
Member

serhalp commented Jul 24, 2025

@TheAlexLichter hmm, those tests are failing on all platforms and I can repro locally on your branch. how are you running tests locally?

build first:

npm run --workspaces build

run all tests:

npm run --workspaces test:ci

(or test:dev)

run tests for one package (e.g. packages/vite-plugin and packages/otel are failing):

npm run -w ./packages/vite-plugin test:ci

seems to be something with a transitive dependency of packages/otel missing... could it be a tsdown/rolldown bug? misconfiguration on our part?

@serhalp
Copy link
Member

serhalp commented Jul 24, 2025

hmm @TheAlexLichter:

tsdown requires Node.js version 20.19 or higher. Please ensure your development environment meets this requirement before installing. While tsdown is primarily tested with Node.js, support for Deno and Bun is experimental and may not work as expected.

from https://tsdown.dev/guide/getting-started

these packages mostly support and test >=20.6.1 (some even ^18.14.0 || >=20 and one ^14.16.0 || >=16.0.0). that might be related? (although CI is failing on 22.x)

is this PR even viable, given this?


export default defineConfig([
{
clean: true,
format: ['cjs', 'esm'],
entry: ['src/bootstrap/main.ts', 'src/main.ts'],
tsconfig: 'tsconfig.json',
splitting: false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fine as consumers import via the entry points only 👍🏻

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we turned off splitting because of a packaging issue in deno 2 that we should probably investigate if we're changing that

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, let's ensure that this packaging issue is resolved by now (or we can adapt the config to avoid code splitting with a workaround)

@TheAlexLichter
Copy link
Author

Strange! Tests all pass fine (I built & ran with node v24.2.0 though).
image

I just updated the lockfile, seems that was faulty in between (I guess some merge conflicts earlier).

tsdown requires Node.js version 20.19 or higher. Please ensure your development environment meets this requirement before installing. While tsdown is primarily tested with Node.js, support for Deno and Bun is experimental and may not work as expected.

these packages mostly support and test >=20.6.1 (some even ^18.14.0 || >=20 and one ^14.16.0 || >=16.0.0). that might be related? (although CI is failing on 22.x)

is this PR even viable, given this?

This is only for the actual CI server / dev environment. The actual target of the libs can be as low as the transformer supports.

@chee
Copy link
Contributor

chee commented Jul 24, 2025

This is only for the actual CI server / dev environment. The actual target of the libs can be as low as the transformer supports.

when we test on node 18, we build on node 18:

https://github.com/netlify/primitives/blob/main/.github/workflows/test.yaml#L56-L90

(we don't have to do that, but we do that at the moment)

@TheAlexLichter
Copy link
Author

TheAlexLichter commented Jul 25, 2025

This is only for the actual CI server / dev environment. The actual target of the libs can be as low as the transformer supports.

when we test on node 18, we build on node 18:

main/.github/workflows/test.yaml#L56-L90

(we don't have to do that, but we do that at the moment)

Checked locally and building + testing works fine with Node 18 too 👍🏻

CI is also green in my fork

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: chore work needed to keep the product and development running smoothly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants