Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@

To enable ES6 features, use `?harmony` in your loader config. To auto insert the pragma required to process the file use the insertPragma parameter e.g. `?insertPragma=React.DOM`. [Flow]-style type annotations can be stripped using `?stripTypes`.

Additionally, any valid [React Tools command-line options](https://github.com/facebook/react/blob/master/npm-react-tools/README.md#command-line) can be specified as loader config options.

[Flow]: http://flowtype.org/
Flow: http://flowtype.org/
13 changes: 3 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,11 @@ module.exports = function(source) {

var sourceFilename = loaderUtils.getRemainingRequest(this);
var current = loaderUtils.getCurrentRequest(this);
var transformOptions = loaderUtils.parseQuery(this.query);
transformOptions.sourceMap = this.sourceMap;

var query = loaderUtils.parseQuery(this.query);
if (query.insertPragma) {
source = '/** @jsx ' + query.insertPragma + ' */' + source;
}
var transform = reactTools.transformWithDetails(source, transformOptions);

var transform = reactTools.transformWithDetails(source, {
harmony: query.harmony,
stripTypes: query.stripTypes,
es5: query.es5,
sourceMap: this.sourceMap
});
if (transform.sourceMap) {
transform.sourceMap.sources = [sourceFilename];
transform.sourceMap.file = current;
Expand Down