-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
TypeScript setup #200
Comments
I've pushed a branch to use I started from back when the code was using TypeScript and changed just the |
@pngwn felt that we would want to bundle intermediate packages and thus keep Rollup in the loop Pros of bundling:
Cons of bundling:
His suggestion was to use |
|
I was able to get a fix in for rollup/plugins#247. rollup/plugins#287 is much less of an issue, so shouldn't be a blocker. It's easy to search on Google in order to find the workaround of specifying I've setup a branch that uses |
Out of curiosity, I just tried No configuration necessary. See this branch and particularly the last commit. The first two files is all the config that was needed. The rest is me trying it with The good thing is that it's easy to adopt incrementally. This commits only sets up typescript for the |
I'm leaving some notes here for when we eventually take a stab at adding back TypeScript.
Issues we encountered
We had originally tried getting
@rollup/plugin-typescript
working, but encountered a couple issues:We instead setup
rollup-plugin-typescript2
, which was really easy to get setup. However, we eventually did hit one issue:failed to transpile
error --noEmitOnError: true
breaks rpt2 ezolenko/rollup-plugin-typescript2#254 - errors are swallowed and you need to runtsc
manually to get the real error message. I suspect this has something to do with our usage ofpnpm
and corresponding directory structure (e.g. some libraries are present in../../node_modules
if you're in a subpackage).@rollup/plugin-typescript
is super finicky and really hard to get working.rollup-plugin-typescript2
was really easy to setup though it seems not to supportpnpm
yet and swallows error messages as a result. Normally I would think the best place to focus my efforts would be to fix the one issue inrollup-plugin-typescript2
and then eventually re-enabled it. However, it turns out thatrollup-plugin-typescript2
does not have any tests! So in the long-run perhaps it's better to put more work into@rollup/plugin-typescript
even though it might be further from working really wellThe other issue we were hitting was that the project wasn't being compiled on the CI, so we had a few PRs that broke things. That seems easily avoidable and basically fixed at this point
Suggested solution
I wonder if a lot of our issues may be avoided by just calling
tsc
directly and removing Rollup from our build process given that the Rollup TypeScript plugins are so finicky. It certainly seems like it would avoid an extra layer of potential complication. TypeScript doesn't yet support npm's newexports
map, which means we'll have to continue outputting files to the subpackage root directory instead of using something like adist/
directory (microsoft/TypeScript#33079)The text was updated successfully, but these errors were encountered: