-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes to docusaurus.config.js only picked up once per yarn start
invocation
#5252
Comments
Is it a problem that only happens with beta.4? Did it use to work with older versions? Have you tried changing something else than the prism theme? Like navbar items or a md doc? It is likely an issue in the file-watching system. It may be a problem on your system, or one of the libs we use, because it generally works fine for most users an we didn't change anything about that recently. I suggest trying |
Hi @slorber thank you for your reply :)
I don't remember... However, I tried creating a new site using
I tried changing the navbar title, it exhibits the same behaviour. However, if I change an MD document, the site is rebuilt.
Okay... is there a difference in the file-watching system, for
Using this, the site will usually be rebuilt after I change some value in |
docusaurus 2.0.0-beta.0 and 2.0.0-beta.4 have the same behavior:
|
Thanks
Yes, docs are watched by Webpack's internal dependency graph system, while the config file and other things are watched using the chokidar lib. const fsWatcher = chokidar.watch(pathsToWatch, {
cwd: siteDir,
ignoreInitial: true,
usePolling: !!cliOptions.poll,
interval: Number.isInteger(cliOptions.poll)
? (cliOptions.poll as number)
: undefined,
});
['add', 'change', 'unlink', 'addDir', 'unlinkDir'].forEach((event) =>
fsWatcher.on(event, reload),
); If you want to help us debug this issue, you can try to add some logs in Maybe you are using symlinks or a special file-system folder, or you have some specific file-system that is not supported by chokidar, or chokidar might have a bug preventing you to get the watcher events being fired. Unfortunately, it will be hard for me to solve this issue. It's also not very probable that this is a Docusaurus bug so I'm going to closes it, but happy to re-open if you can prove that chokidar is working correctly and this is our Docusaurus integration that fails. Otherrwise I suggest creating a small repro and opening a bug report on Chokidar directly |
Hi @slorber , thanks for suggesting that! I went down the rabbit hole, and I think I re-discovered paulmillr/chokidar#791 and its related issues, including paulmillr/chokidar#35, paulmillr/chokidar#601, and paulmillr/chokidar#742 I've set up a repo to easily reproduce this problem at: https://github.com/wpyoga/repro-docusaurus-5252 . It contains both docusaurus and non-docusaurus-specific (chokidar only) code. You are welcome to take a look and try it out. So far it works on my Linux laptop. I'm using the standard ext4 file system. And I'm not using symlinks either.
Since the docs seem to be watched quite reliably, is it possible to watch the config file using a similar mechanism? |
Thanks for investigating this. What I understand is that it's an issue happening only when using some editors like Vim right? Unfortunately, I'm not sure what I can do here, hopefully Chokidar will fix this.
I'm not sure it is possible, and not even sure the Webpack watcher system is public api. Webpack is responsible for tracking the dependency graph of the frontend React application to build, not the NodeJS code. We use Chokidar to watch for changes in the Node.js side, which Webpack is not responsible for. |
🐛 Bug Report
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
When I run
yarn start
, and then edit & savedocusaurus.config.js
a few times, only the first save is recognized. If I want further changes to take effect, I have to terminate the development server (Ctrl-C) and runyarn start
again.Have you read the Contributing Guidelines on issues?
Yes
Steps to reproduce
Follow the steps here: https://docusaurus.io/docs/installation to create a new repo, then modify
docusaurus.config.js
.Create a new docusaurus site:
Run the development server:
Now change the first line in
docusaurus.config.js
and save:On the terminal, observe that the site is rebuilt:
Open http://localhost:3000/docs/intro and see that the code block theme has now changed.
Now change the first line in
docusaurus.config.js
again and save:On the terminal, there is no activity at all.
Reload the page at http://localhost:3000/docs/intro and see that the theme has not changed.
Further changes to
docusaurus.config.js
are not picked up until I stop the development server and start it again.Expected behavior
When I modify
docusaurus.config.js
, the site is rebuilt.Actual behavior
The expected behavior happens only the first time I modify
docusaurus.config.js
. Any further modifications to that file don't trigger site rebuild. In this state, modifications to documents insideblog/
anddocs/
still trigger site rebuild.Your environment
Additional info: I have also reproduced this bug using Node.js 14.17.4 and yarn 1.22.11.
Reproducible demo
Please follow the above steps to reproduce the issue.
The text was updated successfully, but these errors were encountered: