create-react-app 不再监视文件的更改
create-react-app no longer watches changes to files
升级到最新版本的 create-react-app 后,我 运行 遇到了一个大问题,即 web pack 不再监视更改。
在我的项目中,我使用 node_modules
来保留我所有的项目源代码,虽然我可以从这里毫无问题地导入代码,但 web pack 不再监视此文件夹,这意味着所做的任何更改都需要重新启动非常令人沮丧的项目。
下面是我的项目结构的示例:
my-app/
node_modules/
package.json
.gitignore
public/
favicon.ico
index.html
src/
node_modules/
my_app/
components/
ui/
resources/
styles/
images/
App.js
index.js
同样,创建一个使用新组件没问题,但更改不再在浏览器中实时更新,我似乎找不到解决方案。
在react-scripts
中create-react-app
,有一个webpackDevServer的配置; webpackDevServer.config.js
目录node_modules
被忽略。你能把这个去掉试试吗?
升级到最新版本的 create-react-app 后,我 运行 遇到了一个大问题,即 web pack 不再监视更改。
在我的项目中,我使用 node_modules
来保留我所有的项目源代码,虽然我可以从这里毫无问题地导入代码,但 web pack 不再监视此文件夹,这意味着所做的任何更改都需要重新启动非常令人沮丧的项目。
下面是我的项目结构的示例:
my-app/
node_modules/
package.json
.gitignore
public/
favicon.ico
index.html
src/
node_modules/
my_app/
components/
ui/
resources/
styles/
images/
App.js
index.js
同样,创建一个使用新组件没问题,但更改不再在浏览器中实时更新,我似乎找不到解决方案。
在react-scripts
中create-react-app
,有一个webpackDevServer的配置; webpackDevServer.config.js
目录node_modules
被忽略。你能把这个去掉试试吗?