facebook / facebook/docusaurus
Conflicting versions when using canary releases + third-party plugins
- Ngôn ngữ chính
- TypeScript
- Star
- 66.2k
- Fork
- 10k
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 52
Mô tả
### Have you read the Contributing Guidelines on issues?
- [X] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#reporting-new-issues).
### Prerequisites
- [X] I'm using the latest version of Docusaurus.
- [X] I have tried the `npm run clear` or `yarn clear` command.
- [X] I have tried `rm -rf node_modules yarn.lock package-lock.json` and re-installing packages.
- [ ] I have tried creating a repro with https://new.docusaurus.io.
- [ ] I have read the console error message carefully (if applicable).
### Description
Let's imagine you are using a canary release of Docusaurus, and also a third-party plugin.
You likely have this in your package.json file:
```
"@docusaurus/core": "0.0.0-5170",
"@docusaurus/preset-classic": "0.0.0-5170",
"@easyops-cn/docusaurus-search-local": "^0.28.0",
```
Problem: `@easyops-cn/docusaurus-search-local` depends on many Docusaurus core packages with semver range `^2.0.0-beta.20`, and `^2.0.0` does not match `0.0.0`
This potentially leads to duplicate core package installs in your repo, and multiple versions of the same package being used at runtime.
This is particularly problematic for packages exporting React providers because contexts are now duplicated, leading to weird issues like this one https://github.com/facebook/docusaurus/issues/7686#issuecomment-1172377776
A workaround is to use things like npm/yarn resolutions so that the user forces the package manager to duplicate packages.
We'll probably move `@docusaurus/theme-common` to peerDependency in the future, as it's the package most likely to cause troubles (exporting many React contexts)
Another possibility is to change another time the canary versioning scheme, maybe using `3.0.0-something` for the canaries after we release 2.0? This should be changed carefully, as this scheme has been the source of troubles in the past, see https://github.com/facebook/docusaurus/pull/5295)
### Reproducible demo
_No response_
### Steps to reproduce
see https://github.com/facebook/docusaurus/issues/7686#issuecomment-1172377776
### Expected behavior
Use canary + third-party plugin without duplicated packages and weird React context issues
### Actual behavior
see https://github.com/facebook/docusaurus/issues/7686#issuecomment-1172377776: unexpected React context issues
### Your environment
- Public source code:
- Public site URL:
- Docusaurus version used:
- Environment name and version (e.g. Chrome 89, Node.js 16.4):
- Operating system and version (e.g. Ubuntu 20.04.2 LTS):
### Self-service
- [ ] I'd be willing to fix this bug myself.
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.