Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Add a quick-start guide on React with webpack #153

Merged
merged 12 commits into from
Feb 18, 2016
Merged

Conversation

DanielRosenwasser
Copy link
Member

This is the first of several tutorials in starting up a project using several different frameworks. The idea is to reduce JavaScript fatigue in beginners and those taking a cursory glance at TypeScript.

Also, thanks for helping me out with this @yuit!

@DanielRosenwasser
Copy link
Member Author

```

You'll be given a series of prompts.
For your entry point, use `./lib/bundle.js`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add "Use the defaults, except for entry point. For your entry point, ..."

@sandersn
Copy link
Member

Nice! It worked for me with only one hiccup.

@RyanCavanaugh
Copy link
Member

👍 w/ Nathan's comments

@sandersn
Copy link
Member

:+!:

@@ -0,0 +1,168 @@
This quick start guide will teach you wire up TypeScript with [React](http://facebook.github.io/react/) and [webpack](http://webpack.github.io/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will teach how to you wire up TypeScript with?

@yuit
Copy link
Contributor

yuit commented Feb 17, 2016

👍

# Write some code

Let's write our first TypeScript file using React.
Create a new file in your `src` directory named `index.tsx`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add link here to more information about tsx/jsx support.

@mhegazy
Copy link
Contributor

mhegazy commented Feb 17, 2016

how about debugging? you should enable soruceMap support in tsconfig step, and make sure we have that working as well through webpack.

@DanielRosenwasser
Copy link
Member Author

@basarat @pspeter3 do you have any feedback on this? Do you have any opinions between ts-loader and awesome-typescript-loader?

@pspeter3
Copy link

I have used ts-loader before but only casually. Asana uses Bazel for our TypeScript compilation

Next, we'll add development-time dependencies on [ts-loader](https://www.npmjs.com/package/ts-loader) and [source-map-loader](https://www.npmjs.com/package/source-map-loader), both will let TypeScript and webpack play well together.

```shell
npm install --save-dev ts-loader
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm install --save-dev ts-loader source-map-loader

npm install --save react react-dom
```

Next, we'll add development-time dependencies on [ts-loader](https://www.npmjs.com/package/ts-loader) and [source-map-loader](https://www.npmjs.com/package/source-map-loader), both will let TypeScript and webpack play well together.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both will let TypeScript and webpack play well together

Extend a bit that? Maybe a one-sentence addition like 'webpack uses ts-loader to load tsconfig and compile your TypeScript upon running webpack' and something similar for source-map (I don't know what ts-loader does, this is my guess).

@basarat
Copy link

basarat commented Feb 18, 2016

Do you have any opinions between ts-loader and awesome-typescript-loader?

@DanielRosenwasser awesome-typescript-loader was deprecated to put everyone in to community backing one defacto loader : https://github.com/TypeStrong/ts-loader 🌹

I personally wrote : https://basarat.gitbooks.io/typescript/content/docs/quick/browser.html of the top of my head once but I didn't test it ... haven't heard any complaints :) 🌹

@DanielRosenwasser
Copy link
Member Author

I'm not seeing anything about deprecation - both look like good/well-maintained projects. Mostly, I was trying to get an idea what an introductory react workflow might be like, but ts-loader seems to be the weapon of choice for both of you. Thanks!

@basarat
Copy link

basarat commented Feb 18, 2016

@DanielRosenwasser My bad. Deprecation was TypeScript-loader : andreypopp/typescript-loader#27 However I just saw s-panferov/awesome-typescript-loader#94 in awesome-typescript-loader ¯\_(ツ)_/¯

Personally I just do tsc -watch or let atom-ts do the compile and webpack just to bundle the js like a standard js project 🌹 But its not something that everyone has the luxury or desire to do ... hence ... loaders.

DanielRosenwasser added a commit that referenced this pull request Feb 18, 2016
Add a quick-start guide on React with webpack
@DanielRosenwasser DanielRosenwasser merged commit 32f5626 into master Feb 18, 2016
@DanielRosenwasser DanielRosenwasser deleted the react-webpack branch February 18, 2016 20:33
@s-panferov
Copy link

@DanielRosenwasser @basarat ts-loader is a better choice for community because it is small and simple and maintained by several people in TypeStrong. awesome-typescript-loader is a solution for those who need additional functionality it provides.

@cancan101
Copy link

In the two years since this was closed, is awesome-typescript-loader still preferred to ts-loader? Or perhaps better said, have the missing atl features been added to ts loader?

@pspeter3
Copy link

I still use ts-loader anytime I use Webpack outside Asana. (We compile the TypeScript before Webpack with Bazel at Asana)

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.

10 participants