Add react-dom as an optional dependency
amanteaux opened this issue · 1 comments
amanteaux commented
Currenty batchingForReactDom.js references react-dom
even through react-dom
is not referenced in the project package.json
file.
It seems to cause an issue with recent versions of Yarn.
Would it be possible to react-dom
to the optional dependencies of the package.json
file? And I guess it should be the same with react-native
.
Here is the full error from Yarn:
errors: [
{
detail: undefined,
id: '',
location: {
column: 25,
file: '../.yarn/__virtual__/micro-observables-virtual-7722fe8c8c/0/cache/micro-observables-npm-1.7.2-8e88bfdb52-15dd9eadc5.zip/node_modules/micro-observables/batchingForRea
ctDom.js',
length: 11,
line: 1,
lineText: 'const ReactDOM = require("react-dom");',
namespace: '',
suggestion: ''
},
notes: [
{
location: {
column: 33,
file: '../.pnp.cjs',
length: 343,
line: 9047,
lineText: ' "packageDependencies": [\\',
namespace: '',
suggestion: ''
},
text: `The Yarn Plug'n'Play manifest forbids importing "react-dom" here because it's not listed as a dependency of this package:`
},
{
location: null,
text: 'You can mark the path "react-dom" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/cat
ch block to handle this failure at run-time instead of bundle-time.'
}
],
pluginName: '',
text: 'Could not resolve "react-dom"'
}
]
amanteaux commented
Until this is solved in micro-observables, this issue can be mitigated through the .yarnrc.yml
file by adding:
packageExtensions:
micro-observables@*:
dependencies:
react-dom: "*"