Skip to content
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 example shows the "not preferred" way? #935

Closed
sarink opened this issue Apr 17, 2018 · 5 comments
Closed

Typescript example shows the "not preferred" way? #935

sarink opened this issue Apr 17, 2018 · 5 comments

Comments

@sarink
Copy link

sarink commented Apr 17, 2018

The readme suggests adding babel before typescript as the preferred way https://github.com/gaearon/react-hot-loader#typescript. I think everyone would agree, since this allows you to compile to es5 (es6 just isn't supported well enough yet, I imagine only a very small portion of devs are actually compiling straight to es6).

However, in the examples directory https://github.com/gaearon/react-hot-loader/tree/master/examples/typescript, this es6-only not-recommended configuration is what's shown.

It would be nice to have an example of the "recommended" configuration also.

Thanks!

@theKashey
Copy link
Collaborator

The example was created in December, "preferred way" was found weeks ago. That is the answer.

@evenfrost
Copy link

@sarink 'Preferred way' wasn't working for me as well, so I've ended up with this.

@gregberge
Copy link
Collaborator

Typescript setup looks like not very clear, I think we have to improve the readme.

@micimize
Copy link

I don't see why putting babel before typescript should be considered preferable. If you pass the typescript es6 output to babel, babel will then compile that toes5. If you want to also have a separate standalone tsc task, you can just use cli flags to override.

I don't know much about @babel/plugin-syntax-typescript, but even if it has 100% parity with typescript@latest syntax, we can probably assume it lags behind @next. Either way, by the time the babel-first config gets to the typescript loader, it's already been stripped of all typescript-relevant syntax, so you might as well just remove it.

@theKashey
Copy link
Collaborator

babel-after-ts might be the best way, as long it does not require babel7, but will not work with some boilerplates which don't let you specify dev/build tsconfigs.

Lets assume that we just listing possible configs, and which one to use - is up to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants