基础项目配置
原文地址:
https://hansrwindhoff.wordpress.com/2015/10/28/jspm-typescript-reactjs-in-es2015-es6/
- node.js
- typescript -g
- typings -g
- lite-server
- concurrently
Create a folder, change into it.
npm init (choose the defaults)
npm install jspm –save-dev
jspm init
Follow the prompts and choose the defaults, except when asked for which transpiler, choose typescript.
jspm install react react-dom
typings install react react-dom –ambient –save
Create an index.html file and add these lines, wordpress will not let me insert html as raw text here so you could copy it from the source files here .
|
Create a folder called ‘app’ and change into it; create a file called main.tsx, this is the jsx typescript file type.
Typescript can transpile jsx expressions and also statically type these. Wow!!! …insert these lines, get them as text from here:
/// <reference path="./../typings/browser.d.ts" /> |
Create a file called tsconfig.json (under app folder), this is the file that configures the typescript compiler, enter this json:
{ |
package.json scripts:
{ |