Replies: 1 comment
-
First of all, thank you for the support! For the module main and exports, it's indeed included for older node versions as they do not support exports, best place to learn about the history of this is actually the tshy readme that I mentioned above, it's one of those things that can't hurt to have as even setting some combinations of targets and moduleResolutons in tsconfig can cause behavior similar to old node versions so it's not just a matrer of what node version you're using unfortunately, at least when it comes to types. For biome vs prettier I don't really care much about the tailwind class sort order and it's not a deal breaker for me, same for the imports, I only care about consistency and speed of development so that's why I love biome, also because it eliminates the need for 10+ external dependencies, version matching between eslint and those deps, more moving parts etc. We also are a beonze sponsor in biome so that tells you how much I like it 😅 |
Beta Was this translation helpful? Give feedback.
-
I recently went through my own exploration of how to start a TypeScript project in 2024, days before you published your helpful video. I wish I had started with your template instead, although by doing my own research, I came to some different choices, and I'm wondering if you could share your thoughts on these, or point me to resources where you've shared these:
tsup vs. tsc / CommonJS support
I found tsup via remix-hook-form project as what might be a modern example to shoot for. I started off thinking I have to support both CommonJS and ESM, but after further investigation, I felt more uncertain I needed to support CommonJS, since I am only interested in supporting what Remix currently supports—Node v18 and up. I also wanted typechecking to happen with my linting.
Those two choices seemed to eliminate the advantages of tsup (export in multiple module formats and rapid build times—in large part because it skips type checking, so you have to run
tsc
to lint the types, anyway). So tsc seems more than adequate for a modern library, unless I've missed something. (I admit reading the TypeScript docs on "Modules - Theory" felt overwhelming 🤯.)Maybe this also eliminates the need for
"check:exports"
, which I would guess you're running because tsup--dts
has documentation saying it might not always get the type definitions correct."main" and "module" vs. "exports"
I think Node v10 and above support
"exports"
and will prioritize"exports"
if detected. I think we should no longer include"main"
and"module"
. Also, as far as I can tell from my research,"module"
was only a de facto standard and never officially adopted in thepackage.json
spec.Mixing "require" and "import"
I'm confused by
"require"
under"import"
and"import"
under"require"
in your"exports"
. I don't know how you would end up getting to those. Maybe "default" makes sense for those cases, or they can be omitted entirely?biome vs. prettier
biome has two outstanding issues that are blockers for me: sort order in organizing imports (issue #3177, in progress) and Tailwind class sorting (issue #1274). Until these are both resolved, I decided it's best to stick with prettier. I've not personally felt interrupted by prettier's performance.
Beta Was this translation helpful? Give feedback.
All reactions