andreypopp / reactify

[DEPRECATED] Browserify transform for JSX (superset of JavaScript used in React library by Facebook)
MIT License
690 stars 62 forks source link

Parse error with transforming with non jsx files #66

Closed variable closed 9 years ago

variable commented 9 years ago

My project has very similar require hierarchy to this https://truongtx.me/2014/07/18/using-reactjs-with-browserify-and-gulp/

My actual gulp task looksl ike

browserify({
    entries: [
        paths.js+'/lib/activities/activities.js',
    ]
}).transform(reactify).bundle().pipe(source('bundle.js')).pipe(gulp.dest(paths.js_built+'/activities'));

But I am getting Parse error with unexpected token in a jsx file which activities.js imports.

variable commented 9 years ago
events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Parsing file /Users/jameslin/projects/xxxx/node_modules/app/comments/comment_box.jsx: Unexpected token (6:8)
    at Deps.parseDeps (/Users/jameslin/projects/xxxx/node_modules/browserify/node_modules/module-deps/index.js:437:28)
    at fromSource (/Users/jameslin/projects/xxxx/node_modules/browserify/node_modules/module-deps/index.js:375:48)
    at /Users/jameslin/projects/xxxx/node_modules/browserify/node_modules/module-deps/index.js:370:17
    at ConcatStream.<anonymous> (/Users/jameslin/projects/xxxx/node_modules/browserify/node_modules/concat-stream/index.js:36:43)
    at ConcatStream.EventEmitter.emit (events.js:117:20)
    at finishMaybe (/Users/jameslin/projects/xxxx/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js:460:14)
    at endWritable (/Users/jameslin/projects/xxxx/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js:469:3)
    at ConcatStream.Writable.end (/Users/jameslin/projects/xxxx/node_modules/browserify/node_modules/readable-stream/lib/_stream_writable.js:436:5)
    at DuplexWrapper.onend (/Users/jameslin/projects/xxxx/node_modules/browserify/node_modules/readable-stream/lib/_stream_readable.js:537:10)
    at DuplexWrapper.g (events.js:180:16)
    at DuplexWrapper.EventEmitter.emit (events.js:117:20)
    at /Users/jameslin/projects/xxxx/node_modules/browserify/node_modules/readable-stream/lib/_stream_readable.js:934:16
andreypopp commented 9 years ago

See https://github.com/andreypopp/reactify#code-in-3rd-party-packages-isnt-being-transformed-by-reactify that might be the problem.

variable commented 9 years ago

Thanks! Transform globally worked.