Skip to content
This repository was archived by the owner on Feb 15, 2023. It is now read-only.

Switch Rollup TypeScript plugins #161

Closed
wants to merge 1 commit into from
Closed

Conversation

benmccann
Copy link
Member

@benmccann benmccann commented Aug 16, 2020

The "official" one doesn't work very well. I've hit endless errors with it. E.g. it crashes anytime your code has a compile error.

I couldn't get it to work at all with Sapper due to an open issue when implementing it there, so ended up having Sapper use rollup-plugin-typescript2 after trying two other plugins

The "unofficial" one is actually used a lot more:

  • @rollup/plugin-typescript - 53k weekly download
  • rollup-plugin-typescript2 - 260k weekly downloads

Now I know why...

@benmccann
Copy link
Member Author

benmccann commented Aug 16, 2020

It seems another solution might be setting noEmitOnError: false for the "official" plugin in the rollup config, but I still wonder if it might be better to just use the one that works by default. rollup/plugins#272

@shellscape
Copy link

Man, this is a pretty snarky swipe at a lot of people who have put in a lot of free time on a project. We have zero skin in which plugin in used, official or not, and I generally council people to use what works best for them. But I take exception with the portrayal of others' hard work in the PR description.

So it's on the record here, this is an exert from rollup/plugins#541, which @benmccann opened earlier today:

NPM downloads are not an indicator of quality. They're usually an indicator of legacy. ts2 was created because rollup-plugin-typescript fell into neglect and disrepair. The scoped, official plugin came into being last year after many users had abandoned the old plugin. The nuance behind stats is important, ignore them at peril.

@rollup/plugin-typescript is a full rewrite from the absolutely broken, and now deprecated rollup-plugin-typescript. It's been available less than a year, and with a lone contributor squeezing whatever free time available into it. typescript2 has been around over three years. That the plugin already accounts for 20% of the weekly downloads of another that has been around 2.5x as long is a testament to its quality.

I'd expect better from someone in a lead contributor position in a related project. Svelte, Sapper, Rollup - they're all related - and the swipes here are sad and disappointing. As someone involved prolifically in open source, you should know better. Do better.

@benmccann
Copy link
Member Author

I'm sorry if some of my frustration is showing through here. I respect all the time you've put into the plugins and am thankful for it. I've spent a lot of time testing many different versions of @rollup/plugins-typescript and reporting issues and hope to see it continue to progress.

The context here is that I've spent many dozens of hours in the past couple of week trying to get a basic template project with TypeScript working. I hit three different bugs with @rollup/plugins-typescript (one of which is now fixed, so thanks to the team for helping me with that!), tried rollup-plugin-ts, and then finally got things working with rollup-plugin-typescript2.

This was just my personal experience with the plugins and understand that may not be representative of what all users have experienced and that I may have a different experience on a larger project. At the end of the day we have to have some plugin listed in the template, and it made sense to me to use the one I've had the best experience with. I've been getting multiple questions per day about how to get TypeScript working and am hoping to reduce the number of issues people hit and this seemed like a way to do that (and my own experience may not be the whole picture, but is all I have to go off of)

(I wrote the description of this PR before you replied regarding the download numbers. I appreciate the explanation that they reflect more than the current quality of the plugins. I included the numbers not as a swipe, but because I thought it made sense to use the more widely used plugin. I was frustrated that the more trodden path is not the one that's more promoted and easily discoverable)

@dummdidumm
Copy link
Member

I cannot import TypeScript files in Svelte files when using rollup-plugin-typescript2.

@benmccann
Copy link
Member Author

Hmm, weird that I haven't encountered that, but I'm pretty tired of debugging project setup stuff, so I'll go ahead and close this in favor of #173 since the other one seems to work better for you

@benmccann benmccann closed this Sep 8, 2020
@benmccann benmccann deleted the benmccann-patch-3 branch January 21, 2021 15:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants