Question

I'm trying to precompile my React JSX files with:

jsx --watch dev/js/ public/js/

I have the non-minified react.js file (0.9.0) in the subdirectory dev/js/lib. When it compiles, the React source becomes public/AutoFocusMixin.js. Along with being renamed, the source is "moved" to the parent directory.

This only happens when I use the non-minified version of React. The compiled file is not minified. I'm using the non-minified source for debugging.

I had a similar problem with version 0.8.0 -- but instead of being named AutoFocusMixin, the resulting file was named $.js and was also in the parent directory.

My solution was to manually copy the non-minified source to the correct location.

Has anyone come up with a better solution for this or see what I'm doing wrong?

--

I assume this is the offending code in the React source (below). I see what it does but am unclear of its purpose. I confirmed the file I'm using is the React core without add-ons.

var AutoFocusMixin = {
  componentDidMount: function() {
    if (this.props.autoFocus) {
      this.getDOMNode().focus();
    }
  }
};

module.exports = AutoFocusMixin;
Was it helpful?

Solution

Looks like a bug in React. I just filed https://github.com/facebook/react/issues/1145 and we'll try to get that fixed soon. As a temporary workaround you should be able to fix it by removing all lines of react.js containing @providesModule.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top