Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add react-dom as an optional dependency #33

Open
amanteaux opened this issue Jan 24, 2023 · 1 comment
Open

Add react-dom as an optional dependency #33

amanteaux opened this issue Jan 24, 2023 · 1 comment

Comments

@amanteaux
Copy link

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
Copy link
Author

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: "*"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant