Generate dependency map for sidebar, docusaurus.config, etc. in hot reload #5039
Labels
difficulty: advanced
Issues that are complex, e.g. large scoping for long-term maintainability.
domain: dx
Related to developer experience of working on Docusaurus sites
proposal
This issue is a proposal, usually non-trivial change
Milestone
🐛 Bug Report
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
In order to avoid having a huge
sidebar.js
file,we created a
main.js file and imported sidebars for different sections from external js files.
We then specified main.js as the sidebarPath.
The problem with this approach is:
main.js
file changes, it looks like it is caching the imported variables from the other files, which also prevents the update.Have you read the Contributing Guidelines on issues?
Yes I have.
Steps to reproduce
main.js
file for your sidebar that imports sub-sidebars from other files likehere.
docusaurus start
.Expected behavior
Docusaurus should be able to notice which files are being imported
by
main.js
and update its sidebar accordinglyActual behavior
Docusaurus only updates if
main.js
changes,and even if it does change,
imported variables from other files are not updated.
Your environment
2.0.0-beta.0
Reproducible demo
https://codesandbox.io/s/competent-sun-t28ho?file=/sidebar/secondary.js
You can try:
secondary/two
fromSECONDARY
insidebar/secondary.js
.SECONDARY
frommain.js
.SECONDARY
again tomain.js
.secondary/one
andsecondary/three
instead of reloading the file and justadding
secondary/one
The text was updated successfully, but these errors were encountered: