-
Notifications
You must be signed in to change notification settings - Fork 488
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
feat(build): use native typescript compiler #64178
base: staging
Are you sure you want to change the base?
Conversation
The default for esbuild/tsup is to use the microsoft api extractor, to generate typescript declarations. However, this appears to result in some memory leaks which ends up causing the build time of declaration files to take very long. This then causes watchers on the webpack side to receive updated javascript but without its associated declarations. Instead, noting that the [official documentation](https://tsup.egoist.dev/#generate-declaration-file) says to use `tsc`, the tsup `onSuccess` hook is then used to generate the typescript declarations in the same manner as before, except using `tsc`. The net result is that the declarations are generated significantly faster, about 2 seconds vs the previous 30-60 seconds.
6690ff7
to
8074fc3
Compare
🖼️ Visual Comparison Report✅ No eyes differences detected! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
big win!
@@ -24,6 +24,7 @@ | |||
"lint": "turbo lint", | |||
"lint:fix": "turbo lint:fix", | |||
"release:dryrun": "turbo release:dryrun", | |||
"start": "yarn dev", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Appreciate the operational consistency detail here
"lint": "eslint .", | ||
"lint:fix": "eslint --fix .", | ||
"prepack": "clean-package", | ||
"postpack": "clean-package restore", | ||
"prettier": "prettier --check .", | ||
"prettier:fix": "prettier --write .", | ||
"release": "release-it --preRelease=alpha", | ||
"start": "yarn dev", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"start": "yarn dev", | |
"start": "cd .. && yarn start --filter @code-dot-org/component-library", |
Just an idea, I'm guessing tsup --watch
here doesn't end up rolling the build up far enough for apps to see?
The default for esbuild/tsup is to use the microsoft api extractor, to generate typescript declarations. However, this appears to result in some memory leaks which ends up causing the build time of declaration files to take very long. This then causes watchers on the webpack side to receive updated javascript but without its associated declarations.
Instead, noting that the official documentation says to use
tsc
, the tsuponSuccess
hook is then used to generate the typescript declarations in the same manner as before, except usingtsc
. The net result is that the declarations are generated significantly faster, about 2 seconds vs the previous 30-60 seconds.