-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
fix typescript config for rollup #3519
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
Conversation
Is this needed to fix the Babel type issue you mentioned? If so, I think we should go with your original approach and remove both nodeResolve and Babel (or at least the Babel Typescript preset). Otherwise we're going to have two tools compiling TypeScript syntax, which doesn't feel right to me. |
We need babel for sure. It just removes all typescript syntax and converts to Javascript. We use To answer your question directly, when I ran the branch I'm about to draft PR, it failed on the first TS syntax. Maybe you can grab that branch and play around with it to find the best config? You seem more versed in the options than I am, it would be good to get this just right. |
(#3520 is the draft PR @nickmccurdy) |
The TypeScript compiler ( Thanks, I'll take a look at #3520 and let you know if I have better ideas. Sorry if my previous config PRs caused confusion, I'm less experienced with the Babel TypeScript preset so I'm not as aware of its limitations compared to the TypeScript compiler. |
I see what you mean, removing the TypeScript Rollup plugin causes unexpected token errors, but I'm not sure why (note that you have to disable JSX in tsconfig to this this first, or TS will think that the |
I managed to fix the syntax error, but there's a circular dependency in #3520. If you want to use the TypeScript compiler, you cannot import the declaration file from src/index.ts, because it has the same path, which will cause the index file to import itself and crash with a stack overflow. It seems like the best way to fix this would be to move |
Also I'm still confused about how the Babel issue was solved. Is the TypeScript compiler needed for this or can we remove it in favor of Babel? |
6dc676c
to
dda48e7
Compare
ok, @nickmccurdy @timdorr I'm pretty sure this is the simplest working setup. I tried changing whether babel had its extensions, and removing the nodeResolve. This fixed nothing. We need I think this is the best setup for now. Perhaps we'll find something better later |
Thanks for your help, I know this isn't easy. In the case that we need TypeScript, I'd rather remove Babel, as we don't seem to be using any part of it that TypeScript itself can't handle. Would you like me to make a PR trying that? We could merge this for now, assuming it works with your other PR. |
not at all, I enjoy this stuff :) I prefer to keep both, as babel has much better support for transpiling features down. typescript is compiling to the latest javascript, and then babel refines it for us. I also imagine that in the future, support for ts will improve, and we can revisit it then. The final call is @timdorr in this, my opinions are only opinions |
OK. I finally have some clarity on this. The configuration will go through 2 stages.
So, this PR should be considered a step-along-the-path PR, but an essential one. |
Interesting, so our dependency on the TypeScript compiler is only because of how we're migrating the |
9c0bb18
to
240fd65
Compare
This is explicitly the plan I'd like to take. My motivation is having human-readable diffs along the way, and a working config as we go. If this seems too git-focused, I'm OK doing everything-at-once, but it should make it easier to roll back if I/we make a mistake along the way. At least that's my theory :P |
so... anything need changing in this PR? |
Sorry, I've been watching from a distance. Also, I've had family in town, so I haven't had time for OSS stuff in the evenings. Let's get this in for now and then get it right back out :) |
no worries, thanks for taking a look! |
It turns out that even with the
nodeResolve
fixes, we still need thetypescript
plugin to build with rollup. This PR fixes that