我对React和node.js非常陌生。
我想运行一个提供React.js页面/视图的node.js服务器。
当我使用'create-react-app'然后使用'npm start'时,我还需要同时启动我的节点服务器,还是需要先使用'npm run build'才能与node.js服务器一起工作?
我喜欢它在更改代码后如何在“ npm start”之后自动更新您的react.js页面。
我只是想知道每次更改时是否都必须运行“ npm run build”命令。
谢谢你的帮助!
我对React和node.js非常陌生。
我想运行一个提供React.js页面/视图的node.js服务器。
当我使用'create-react-app'然后使用'npm start'时,我还需要同时启动我的节点服务器,还是需要先使用'npm run build'才能与node.js服务器一起工作?
我喜欢它在更改代码后如何在“ npm start”之后自动更新您的react.js页面。
我只是想知道每次更改时是否都必须运行“ npm run build”命令。
谢谢你的帮助!
No, you don't need to run
npm run build
command each time as this command is used when you're ready to ship your code to production environment.In a
create-react-app
project, you gethot reloading
out of the box when developing locally (after runningnpm start
). In other words, when the local server is running, every time you make a change the browser will automatically reload.从create-react-app文档中:
https://create-react-app.dev/docs/available-scripts#npm-start