How config React to render .js

I'm trying to let WebStorm to render the .js files for me watching .jsx files.
I'm using or trying to use browserify/babelify and react nodes but I'm getting the following error

/usr/local/bin/browserify -t [babelify --presets react] /Users/myUser/Developer/ApacheRoot/JsFrameworksSamples/ReactJs/Sample_2/src/* -o /Users/myUser/Developer/ApacheRoot/JsFrameworksSamples/ReactJs/Sample_2/src/bundle.js Error: Cannot find module '/Users/myUser/Developer/ApacheRoot/JsFrameworksSamples/ReactJs/Sample_2/src/*' from
'/Users/myUser/Developer/ApacheRoot/JsFrameworksSamples/ReactJs/Sample_2/src' at
/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:55:21 at load
(/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:69:43) at onex
(/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:92:31) at
/usr/local/lib/node_modules/browserify/node_modules/resolve/lib/async.js:22:47 at
FSReqWrap.oncomplete (fs.js:95:15)

Process finished with exit code 1


The configuration for the watcher is the following:
enter image description here

arguments: -t [babelify --presets react] $FileDir$/* -o $FileDir$/bundle.js

what i'm doing wrong?

Thanks

6 comments
Comment actions Permalink

browserify doesn't accept a glob pattern (like dir/*, or *.js, etc.) as etry files list. See https://github.com/substack/node-browserify/issues/1170

0
Comment actions Permalink

thanks for your answer but this is not right, because when I run the same command in terminal, it works OK

anyway...how should I config webstorm/rubymine in order to render jsx?

0
Comment actions Permalink

thanks for your answer but this is not right, because when I run the same command in terminal, it works OK


very strange - as all WebStorm does is running the program specified in Program field with parameters specified in Arguments field. And no, it doesn't work for me in terminal. You you must be doing something different when running it in terminal.

.how should I config webstorm/rubymine in order to render jsx?


in Settings (Preferences if you atre on Mac OSX)/Languages & Frameworks/JavaScript, choose 'JSX Harmony' as 'JavaScript language version'

0
Comment actions Permalink

you can look my terminal (i'm using rubyMine, but in this case webStorm work by the same way) and it's working perfect
Screen Shot 2015-12-14 at 13.55.56.png

I can say that I'd configured the watcher by a diffent way just compiling a single file as you recommended and it's working ok, but of couse by this way it's NOT doing a bundle file....

lena_spb wrote:

     in Settings (Preferences if you atre on Mac OSX)/Languages & Frameworks/JavaScript, choose 'JSX Harmony' as 'JavaScript language version'


setting JSX harmony just helps with intellisence, right? is it compiling to .js files? in case it's compiling...what is the path of the .js files?

0
Comment actions Permalink

setting JSX harmony just helps with intellisence, right?


Yes - it's used for code parsing - i.e. for syntax/error highlighting, completion, navigation, etc.

is it compiling to .js files?

No, it has nothing to do with code transpiling, that is supposed to be done by external tools, like Babel

0
Comment actions Permalink

lena_spb wrote:

setting JSX harmony just helps with intellisence, right?


Yes - it's used for code parsing - i.e. for syntax/error highlighting, completion, navigation, etc.

is it compiling to .js files?

No, it has nothing to do with code transpiling, that is supposed to be done by external tools, like Babel


perfect...now looks like work somehow...anyway I need to understand how to bundle the files into a single file

thanks

0

Please sign in to leave a comment.