vasansr / pro-mern-stack

Code Listing for the book Pro MERN Stack
http://www.apress.com/in/book/9781484226520
342 stars 157 forks source link

npm watch #41

Open deelusional opened 6 years ago

deelusional commented 6 years ago

After I added the "compile": and "watch": to under "scripts": in package.json, I run 'npm run compile' and I see the change 'src/App.jsx -> static/App.js in my terminal. That runs just fine.

But the next step, I made a small change to the var component =

Hello World

; and just added

This is where the change happens?

; then I run 'npm watch', I refresh my chrome browser, and I get no change.

The only time I get any change is when I make changes to the App.js file in the var component =React.createElement('h1', null, 'Hello World');

Is the npm watch supposed to make live changes to the browser?

UPDATE: It all works when I make changes to the App.jsx file THEN npm run compile FOLLOWED by npm run watch. After that, I refresh my browser and the changes are made!!

On page 30 at the top it specifically says "Go ahead and run the new command npm watch". While it does make one transform and doesn't return to the shell, the next part of the paragraph states to make the small changes to App.jsx and refresh your browser.

I was misled as I felt it should have said run the command 'npm run compile' first, then run 'npm watch' and refresh your browser.