Language Tooling Back
ES2015 with JSX
In-browser JSX Transform
If you like using JSX, Babel 5 provided an in-browser ES2015 and JSX transformer for development called browser.js that can be included from CDNJS.
<script type="text/babel"> tag to engage the JSX transformer.
The in-browser JSX transformer is fairly large and results in extraneous computation client-side that can be avoided. Do not use it in production
Productionizing: Precompiled JSX
If you have npm, you can run:
$ npm install -g babel-cli
$ babel --watch src/ --out-dir lib/.
Beginning with Babel 6, there are no transforms included by default. This means that options must be specified when running the
babel command, or a
.babelrc must specify options.
Additional packages must also be installed which bundle together a number of transforms, called presets. The most common use when working with React will be to include the
react presets. More information about the changes to Babel can be found in their blog post announcing Babel 6.
Here is an example of what you will do if using ES2015 syntax and React:
$ npm install babel-preset-es2015 babel-preset-react $ babel --presets es2015,react --watch src/ --out-dir lib/
Helpful Open-Source Projects
The open-source community has built tools that integrate JSX with several editors and build systems. See JSX integrations for the full list.
TypeScript is a type-checker and transpiler that supports type-checking React and JSX. For more info, check out their guide on getting started with React and Webpack, or learn more about TypeScript's JSX support.
To learn more about TypeScript in general, visit the TypeScript homepage.