[英]NextJS isn't updating when pages/containers/components are changed, HMR always returns success
I'm having an issue with NextJS
/ webpack
.我在使用NextJS
/ webpack
遇到问题。
Whenever I make changes, it won't update anything until a full restart of everything.每当我进行更改时,它都不会更新任何内容,直到完全重新启动所有内容。 This takes a really long time to compile, most recently 6.4
seconds for the client and 2.3
for the server.这需要很长时间来编译,最近客户端需要6.4
秒,服务器需要2.3
秒。 Often it has taken 20-30
seconds in the past.过去通常需要20-30
秒。
process.env.NODE_ENV
is undefined, webpack-hmr
and on-demand-entries
both always return empty/success in the browser. process.env.NODE_ENV
是未定义的, webpack-hmr
和on-demand-entries
在浏览器中总是返回空/成功。 My guess would be that Next
/ Webpack
aren't able to watch the files that are being changed.我的猜测是Next
/ Webpack
无法查看正在更改的文件。
My next
version is 6.0.3
and I'm working in Ubuntu 16.04.4 lts
in WSL
on Windows 10.0.17134
.我的next
版本是6.0.3
,我在Windows 10.0.17134
上的WSL
中使用Ubuntu 16.04.4 lts
Windows 10.0.17134
。
The problem persists with a custom server, I'm calling app.getRequestHandler
once, assigning it to handler, then routing get paths ( /{p*}
) to the handler with Hapi v17.5.2
.自定义服务器的问题仍然存在,我调用app.getRequestHandler
一次,将其分配给处理程序,然后使用Hapi v17.5.2
将获取路径( /{p*}
)路由到处理程序。
If you happen to find this "question and solution" and it is still not working...如果您碰巧找到了这个“问题和解决方案”,但它仍然无法正常工作...
Try adding a .env
with CHOKIDAR_USEPOLLING=true
on it, this fixed it for me, because I am not storing the files inside WSL
but in a different disk on Windows...尝试添加.env
与CHOKIDAR_USEPOLLING=true
就可以了,这个固定为我,因为我不是存储里面的文件WSL
,但在Windows不同的磁盘...
I added我加了
config.node = {
fs: 'empty'
}
and now it updates on file changes.现在它更新文件更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.