-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pnpmfile.cjs
30 lines (29 loc) · 933 Bytes
/
.pnpmfile.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const readPackage = (pkg, context) => {
if (pkg.peerDependencies && pkg.peerDependencies.react) {
// fixes react error "Error: Invalid hook call."
// with multiple copy of react in the node_modules folder
context.log(
`[${pkg.name}] Removing react as a peer dependency (https://bit.ly/3jmD8J6).`
);
delete pkg.peerDependencies.react;
}
// Same for react-dom
if (pkg.peerDependencies && pkg.peerDependencies["react-dom"]) {
context.log(
`[${pkg.name}] Removing react-dom as a peer dependency (https://bit.ly/3jmD8J6).`
);
delete pkg.peerDependencies["react-dom"];
}
if (pkg.peerDependencies && pkg.peerDependencies["@mdx-js/react"]) {
context.log(
`[${pkg.name}] Removing @mdx-js/react as a peer dependency (https://bit.ly/3jmD8J6).`
);
delete pkg.peerDependencies["@mdx-js/react"];
}
return pkg;
};
module.exports = {
hooks: {
readPackage,
},
};