rhino
rhino copied to clipboard
`build_js(watch = TRUE)` keeps rebuilding on Windows
Steps to reproduce
Run build_js(watch = TRUE)
on a fresh Rhino project.
What happened?
Rhino keeps rebuilding the JS even when no changes are being introduced to the sources. This leads to high CPU utilization.
yarn run v1.22.18
$ webpack --watch
asset app.min.js 580 bytes [compared for emit] [minimized] (name: main)
runtime modules 670 bytes 3 modules
../../app/js/index.js 704 bytes [built] [code generated]
webpack 5.69.0 compiled successfully in 942 ms
asset app.min.js 580 bytes [emitted] [minimized] (name: main)
runtime modules 670 bytes 3 modules
../../app/js/index.js 704 bytes [built] [code generated]
webpack 5.69.0 compiled successfully in 184 ms
asset app.min.js 580 bytes [emitted] [minimized] (name: main)
runtime modules 670 bytes 3 modules
../../app/js/index.js 704 bytes [built] [code generated]
webpack 5.69.0 compiled successfully in 138 ms
asset app.min.js 580 bytes [emitted] [minimized] (name: main)
runtime modules 670 bytes 3 modules
../../app/js/index.js 704 bytes [built] [code generated]
webpack 5.69.0 compiled successfully in 149 ms
asset app.min.js 580 bytes [emitted] [minimized] (name: main)
Expected behavior
Rhino should rebuild the file once after changes are detected and keep waiting for more changes.
Rhino diagnostics
Windows 10 x64 build 19044 R version 4.2.0 (2022-04-22 ucrt) rhino: 1.0.0 node: v16.15.0 yarn: 1.22.18
Comments
Most likely a Windows problem. Otherwise, yarns works fine.
This behavior is expected. The watch = TRUE
argument to rhino::build_js()
tells it to "keep the process running and rebuilding JS whenever source files change" (see our docs). Just run rhino::build_js()
(watch
is FALSE
by default).
Be assured that I read the docs. The expected behavior is that nothing is done when there are no changes, but it keeps rebuilding even without any changes.
@dmenne Oh, perhaps I misunderstood. To be clear: rhino::build_js(watch = TRUE)
is expected to run forever, but it should only rebuild when changes are detected in the sources.
Can you please confirm: On your system it keeps running and rebuilding even without adding any changes to the files? Does it lead to high CPU utilization?
Yes, and yes (20% on a fast 6-core AMD). Not an RStudio problem, same on console R
Thanks @dmenne for confirming, we'll investigate - I'm reopening the issue.
I can confirm that rhino::build_js(watch = TRUE)
keeps rebuilding JS even without any changes to ../../app/js/index.js
in a new rhino
project.
> rhino::build_js(watch = TRUE)
yarn run v1.22.19
$ webpack --watch
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
asset app.min.js 15 bytes [compared for emit] [minimized] (name: main)
../../app/js/index.js 1 bytes [built] [code generated]
webpack 5.69.0 compiled successfully in 629 ms
asset app.min.js 15 bytes [emitted] [minimized] (name: main)
../../app/js/index.js 1 bytes [built] [code generated]
webpack 5.69.0 compiled successfully in 187 ms
asset app.min.js 15 bytes [emitted] [minimized] (name: main)
../../app/js/index.js 1 bytes [built] [code generated]
webpack 5.69.0 compiled successfully in 210 ms
asset app.min.js 15 bytes [emitted] [minimized] (name: main)
../../app/js/index.js 1 bytes [built] [code generated]
webpack 5.69.0 compiled successfully in 193 ms
asset app.min.js 15 bytes [emitted] [minimized] (name: main)
../../app/js/index.js 1 bytes [built] [code generated]
webpack 5.69.0 compiled successfully in 190 ms
asset app.min.js 15 bytes [emitted] [minimized] (name: main)
../../app/js/index.js 1 bytes [built] [code generated]
webpack 5.69.0 compiled successfully in 168 ms
asset app.min.js 15 bytes [emitted] [minimized] (name: main)
../../app/js/index.js 1 bytes [built] [code generated]
webpack 5.69.0 compiled successfully in 203 ms
asset app.min.js 15 bytes [emitted] [minimized] (name: main)
../../app/js/index.js 1 bytes [built] [code generated]
webpack 5.69.0 compiled successfully in 197 ms
asset app.min.js 15 bytes [emitted] [minimized] (name: main)
../../app/js/index.js 1 bytes [built] [code generated]
webpack 5.69.0 compiled successfully in 171 ms
asset app.min.js 15 bytes [emitted] [minimized] (name: main)
../../app/js/index.js 1 bytes [built] [code generated]
Rhino Diagnostics
> rhino::diagnostics()
Windows 10 x64 build 22621
R version 4.2.1 (2022-06-23 ucrt)
rhino: 1.1.1
node: v18.9.0
yarn: 1.22.19