Closed karlhorky closed 1 month ago
Wonder if this starter could offer us any tips: https://github.com/egoist/ts-lib-starter
Or, also consider moving to one of:
microbundle
unbuild
preconstruct
tsup
pkgroll
Some all-in-one solutions like scaffoldres may offer some inspiration as well (although I guess moving completely to them may have problems similar to tsdx
, if they become less maintained):
Maybe just use tsc
alone: https://cmdcolin.github.io/posts/2022-05-27-youmaynotneedabundler
Maybe another example, this one using esbuild
(and Turborepo!): https://github.com/mmazzarolo/tangerine-monorepo
Examples of switching to tsup
:
Another reason to switch:
During the switch from Yarn to pnpm (#379 ), we also had to add some additional weird configuration:
.github/workflows/build-lint-test.yml
- name: Check types
run: |
pnpm tsc --project __tests__/tsconfig.json
pnpm tsc --project bin/tsconfig.json
pnpm tsc --project docker/tsconfig.json
pnpm tsc --project tsconfig.config.json
My reason for switching:
After encountering issues with TSDX and switching to pnpm in PR https://github.com/upleveled/preflight/pull/379, we must consider migrating away from TSDX as a solution. Currently, we are using node-linker=hoisted
as a temporary workaround, but this may not be a long-term solution.
Different solutions without switching what I tried were to use rollup-plugin-typescript2
package to version 0.32.0 in my package.json
file using PNPM's overrides feature.
"pnpm": {
"overrides": {
"rollup-plugin-typescript2": "^0.32.0"
}
}
However, this approach resulted in a semantic error. I also explored other workarounds, such as using shamefully-hoist=true
with pnpm, but this caused another error related to untyped function calls not accepting type arguments.
I have described these different solutions in detail in this comment
Another option would be to just publish TypeScript, and use node --experimental-strip-types
to run Preflight (no build step)
tsdx
was a nice idea, but it's no longer maintained.Time to come up with our own solution for this, maybe using:
esbuild
tsm
tsx