Skip to content
This repository has been archived by the owner. It is now read-only.

Why are we moving away from typescript for React/Redux project template? #242

Closed
djdu opened this issue Jan 19, 2018 · 14 comments

Comments

@djdu
Copy link

commented Jan 19, 2018

I started working on the JavaScriptServices React/Redux template for my project. Now I see the new template is moving away form TypeScript and lot of code changes. Is there any explanation for this attempt?

@SteveSandersonMS

This comment has been minimized.

Copy link
Member

commented Jan 23, 2018

Yes, the intention is for each of the SPA templates to be as consistent as possible with the de-facto standards used by each SPA technology. For Angular, that means using Angular CLI (which does produce TypeScript-based projects), and for React, that means using create-react-app (which produces modern JavaScript-based projects, not TypeScript).

If we didn't do this, and instead made up our own project conventions, then developers using them would not be able to rely on the third-party SPA framework docs/tutorials/packages applying to their projects.

@chgi

This comment has been minimized.

Copy link

commented Mar 22, 2018

@SteveSandersonMS
Is there / will there be a simple way to enable typescript support after creating the project?
Something like eject CRA, then add these three lines at this place in webpack config?

@SteveSandersonMS

This comment has been minimized.

Copy link
Member

commented Mar 22, 2018

@chgi For the templates themselves, our aim is consistency with the SPA frameworks' de-facto standards, not extending them to include other technologies. You should be able to use whatever tutorials exist online for ejecting from CRA and adding custom build configs, but it's independent from what we're aiming to provide here.

@markhewett

This comment has been minimized.

Copy link

commented Apr 14, 2018

@SteveSandersonMS Is there anything special about how CRA is used to create this template? Someone has forked the react scripts to create a TypeScript version, so can we just recreate the ClientApp directory?

$ rm -rf ClientApp
$ create-react-app client-app --scripts-version=react-scripts-ts # doesn't like ClientApp name
$ mv client-app ClientApp

This seems to work - F5 runs the app in VSCode and it reloads if I modify a file. I've also tried not renaming the client-app directory and just changed ClientApp in the .csproj and Startup.js files and that seems to work too. Is there anything extra that needs to be done? Is there a possibility to allow passing in the --scripts-version parameter to dotnet new react?

EDIT: I guess that last part doesn't make much sense, since it looks like CRA is run to create the template, rather than being run as part of creating a project?

@SteveSandersonMS

This comment has been minimized.

Copy link
Member

commented Apr 16, 2018

@markhewett I'd hope that whatever CRA-based projects and packages exist should be able to work equally well when hosted on an ASP.NET Core app like this template gives you. I can't promise than any specific third-party library does work though; you'd have to try it and see.

@KinsonDigital

This comment has been minimized.

Copy link

commented Jun 23, 2018

What does "ejecting from CRA" mean?

@tpetrina

This comment has been minimized.

Copy link

commented Jun 23, 2018

It means running npm run eject and getting the hidden webpack.config.js out of the react-scripts.
By doing that you can add any features you want to your app, but you stop using react-scripts and cannot update it anymore. So from that point on you are responsible for updating your dependencies.

@jtheisen

This comment has been minimized.

Copy link

commented Aug 25, 2018

The way that these changes happen is unexpected and not properly communicated. I had nothing but a waste of time with these templates.

@jtheisen

This comment has been minimized.

Copy link

commented Aug 25, 2018

Besides, the framework that makes the best use of Typescript's strengths is React, not Angular.

@jtheisen

This comment has been minimized.

@simpert

This comment has been minimized.

Copy link

commented Oct 15, 2018

I vote to NOT use Create react app. It is like a zillion lines of code and who really wants that in a simple boilerplate template. Bring back the much simplified typescript react app template which allowed hacking on very easily I mean after all it provided the webpack.config in the root. I understand wanting to create template off the backs of the react creators but would it be feasible to offer 2 react templates. The good one provided with typescript and the new massive one using create react app.

@simpert

This comment has been minimized.

Copy link

commented Oct 15, 2018

@SteveSandersonMS please view my comment. I think aspnet users would greatly appreciate a Typescript based template as at least an option then the massive CRA based template as another. I understand the CRA choosing many build tools for you and for getting started with react is very simple. I don't understand why one needs a zillion lines of code to get started with like the CRA starts you off. with.

@tpetrina

This comment has been minimized.

Copy link

commented Oct 16, 2018

While in principle I agree with you, who will create that webpack and maintain it? I don't even want to know about webpack just like I don't care about msbuild script used for building my C# apps. It should be stable and transparent. And I feel that the owners of ASP.NET templates don't want to own it. Which is not necessarily bad.

You can still use the old template, but is it up to date with the recent webpack changes? With the recent trend of moving to other plugins? What about code splitting? It is a fast moving world while templates should be more stable than that.

@Meligy

This comment has been minimized.

Copy link

commented Nov 9, 2018

It's worth noting that with CRA 2.1 has official documented TypeScript support via Babel 7. It'll be awesome if we can have a template that uses that!

Update

The link above shows adding TypeScript to existing project, but for a new project, the ONLY change needed is adding --typescript to the command like create-react-app my-app-name --typescript and that's it! See official announcement.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
9 participants
You can’t perform that action at this time.