Allow versions < React 18 as peer dependency
eimerreis opened this issue ยท 5 comments
eimerreis commented
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch @yudiel/react-qr-scanner@2.0.1
for the project I'm working on.
I am using this package in scope of a react 17 based project. From what I saw across the repo, the package does not actively use any React 18 features.
Couldn't we open the peer dependency version range to allow other versions than react 18?
Here is the diff that solved my problem:
diff --git a/node_modules/@yudiel/react-qr-scanner/package.json b/node_modules/@yudiel/react-qr-scanner/package.json
index c2c824d..f897269 100644
--- a/node_modules/@yudiel/react-qr-scanner/package.json
+++ b/node_modules/@yudiel/react-qr-scanner/package.json
@@ -55,7 +55,7 @@
"typescript": "^5.4.5"
},
"peerDependencies": {
- "react": "^18.2.0",
+ "react": "^17.0.0 || ^18.2.0",
"react-dom": "^18.2.0"
},
"dependencies": {
This issue body was partially generated by patch-package.
eimerreis commented
Sorry, forgot to add react-dom
as well
yudielcurbelo commented
Could this work for you?
"peerDependencies": {
"react": "^17 || ^18",
"react-dom": "^17 || ^18"
}
eimerreis commented
yeah would work ๐
yudielcurbelo commented
Please try the new version.
eimerreis commented
@yudielcurbelo works! ๐ Big up for the superfast response & fix