React - jsx --watch does nothing after first conversion

I can’t use JSXTransformer.js in the browser even for development, because I use require.js to load modules. When I run jsx --watch src/ build/ , in fact, only one jsx->js conversion is performed against files in the src directory, but subsequently, if I change any file in the src directory, nothing happens, there is no jsx->js translation jsx->js (for example, if jsx --watch did not notice any changes).

+6
source share
6 answers

The same thing happened to me.

Try this command line:

 jsx --watch -x jsx src/ build/ 
+20
source

I had the same problem, but it helped:

jsx --watch./scr./build

+1
source

Actually, this happens when you try to run a command from the wrong folder or set the wrong path to the folder from which you want to build (for example, "src /"). The write path depends on the structure of your directory. The best way to find out the recording path is to print the "jsx --watch" command and then use Tab to get the directory path you need, or just make sure that the current folder in the terminal contains the assembly / and src / folders.

0
source

I have the same problem, and maybe because I really don’t understand how "-watch" should work. Initially, I did this: open a terminal, punch in the “watch” command (for example, “jsx --watch / src / build”). As soon as I did this, the terminal returned something like "helloworld.js was built." Things are good.

Then I closed the terminal window, after which nothing worked.

Then I reopened the terminal, re-typed the command, and ran the watch command.

Then I closed the terminal and stopped working.

I feel a pattern here. Is the JSX clock command active only when a terminal window is open? I suggested that “watch” is the command to “set it once and forget it,” but does it sound like it is more ephemeral than that?

0
source

You have this problem, probably because of the file suffix there is jsx , and not js , the jsx command does not recognize .jsx files.

You can do as user2038099 said: jsx --watch -x jsx src/ build/

-x, -extension The file extension that is assumed when resolving module identifiers

or you can change the suffix of the files in the src folder to .js .

https://github.com/facebook/react/issues/4269

0
source

I had a problem with Ubuntu 14.04. The jsx command did not give any feedback no matter what arguments I passed to it. In the end, I permanently deleted node and installed using the instructions for Ubuntu at https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

I was previously on nodejs v0.10.28, but now that I am on nodejs v0.12.7 everything works fine.

0
source

All Articles