Skip to content
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

chore: add tsup bundling #14

Merged
merged 5 commits into from
Jul 28, 2023
Merged

chore: add tsup bundling #14

merged 5 commits into from
Jul 28, 2023

Conversation

Julien-R44
Copy link
Member

As discussed

The only concrete thing to do with tsup is to ensure that the package.json exports match the entrypoints specified in tsup config
I've also added validator as a bundled dependency. So yeah bundling dependencies should be done very sparingly because it can be a real headache. But in this case I think it's worth to do it as we've seen in different benchmarks :

Not bundled vs vine/vine + vine/compiler bundled
image

Not bundled vs vine/vine + vine/compiler + validator bundled
image

@thetutlage
Copy link
Contributor

Hello 👋

Looks quite simple. I was going through the documentation of tsup and found a couple of notes we should look into.

Using tsup-node

Screenshot 2023-07-27 at 8 46 43 AM

Validating generated types

We should add this to our build pipeline

Screenshot 2023-07-27 at 8 47 36 AM

@Julien-R44
Copy link
Member Author

Julien-R44 commented Jul 27, 2023

issue with tsup-node is that it ignores even the "noExternal" property, which, in our case, allows validator.js to be bundled
But OK to use this by default everywhere, or even here if we decide to not bundle validator.js


regarding the validation of generated types, I didn't found any good solutions for it. I tried @arethetypeswrong/cli but it has one major problem: arethetypeswrong/arethetypeswrong.github.io#45

it doesn't install dependencies. So, for example, in our ./types file for vine, we import some types from vine/compiler to define others ones :
https://github.com/vinejs/vine/blob/develop/src/types.ts#L18
So, for typescript to understand these types, you need to have vinejs/compiler installed. Something that attw does not do
and with tsc i'm not sure there's an easy and automated way of checking this

i've used tsup a bit on front-end libraries and I've never felt the need to do that, so i would say we can do without it
i've never encountered an error with invalid types generated

@Julien-R44 Julien-R44 changed the title chore: add tsup chore: add tsup bundling Jul 28, 2023
@Julien-R44 Julien-R44 merged commit 627ee41 into develop Jul 28, 2023
12 checks passed
@Julien-R44 Julien-R44 deleted the chore/tsup branch July 28, 2023 12:04
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.

None yet

2 participants