Skip to content

Add sourceMap option to react-tools transform#910

Merged
zpao merged 2 commits intofacebook:masterfrom
andrewdavey:react-transform-source-map
Jun 16, 2014
Merged

Add sourceMap option to react-tools transform#910
zpao merged 2 commits intofacebook:masterfrom
andrewdavey:react-transform-source-map

Conversation

@andrewdavey
Copy link
Contributor

Allow tools like grunt-react to include inline source maps in the
generated JavaScript. Browserify can then combine these source maps when
bundling everything together.

Usage:

var transform = require('react-tools').transform;
var output = transform(jsxContent, {
  sourceMap: true,
  sourceFilename: 'source.jsx'
});

The output will have an inline source map comment appended.

andrewdavey added a commit to andrewdavey/grunt-react that referenced this pull request Jan 16, 2014
Waiting for this facebook/react#910

Usage:

```
grunt.initConfig({
  browserify: {
    options: {
      transform: [ require('grunt-react').browserify.withSourceMaps ],
      debug: true
    },
    app: {
      src: 'index.jsx',
      dest: 'public/index.js'
    }
  }
});
```

Transformed JSX JavaScript output has inline source map comments
appended. Browserify will then combine all these source maps when
bundling.
@zpao
Copy link
Member

zpao commented Jan 21, 2014

Awesome. Could we get the same thing in JSXTransformer?

cc @benjamn

main.js Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: no spaces within brackets, please

@sophiebits
Copy link
Collaborator

Do you mind rebasing? Sorry for the delay on this.

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Allow tools like grunt-react to include inline source maps in the
generated JavaScript. Browserify can then combine these source maps when
bundling everything together.

Usage:

```
var transform = require('react-tools').transform;
var output = transform(jsxContent, {
  sourceMap: true,
  sourceFilename: 'source.jsx'
});
```

The `output` will have an inline source map comment appended.
@andrewdavey
Copy link
Contributor Author

Done 😄

@zpao
Copy link
Member

zpao commented Jun 16, 2014

Cool, this looks great. Thanks a lot!

zpao added a commit that referenced this pull request Jun 16, 2014
Add sourceMap option to react-tools transform
@zpao zpao merged commit 08a207f into facebook:master Jun 16, 2014
@andrewdavey andrewdavey deleted the react-transform-source-map branch June 17, 2014 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants