-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
missing dependency makes import fail with yarn 2 #362
Comments
I'm not using yarn 2 and I'm not sure why the problem occurs. @uiw/react-md-editor@3.11.2
└─┬ @uiw/react-markdown-preview@4.0.5
└── rehype-prism-plus@1.3.2 It doesn't seem to lack |
react-md-editor imports it directly, making it a dependency of this package as well as of the markdown preview so it should be in the dependencies. |
My understanding is not so. Whether to depend on Previously, we also replaced @mapbox/rehype-prism with the dependency rehype-prism-plus。 |
https://github.com/uiwjs/react-md-editor/blob/master/src/components/TextArea/Markdown.tsx#L3 react-md-editor directly depends on the package here, making it a direct dependency of react-md-editor as well. While previously yarn and npm still allow it as long as one of the dependencies of yours has it as their dependency, but it is still invalid and with yarn 2 they made it an error (which has to be resolved by adding a package extension that fixes your package json). No one can use this package if they use yarn 2. Main Information: https://yarnpkg.com/advanced/rulebook#packages-should-only-ever-require-what-they-formally-list-in-their-dependencies https://yarnpkg.com/getting-started/migration#fix-dependencies-with-packageextensions and https://yarnpkg.com/getting-started/migration#a-package-is-trying-to-access-another-package- |
@bradennapier How should I fix it to support yarn 2? |
I'm also encountering this issue while trying to migrate from npm to pnpm, which treats dependencies in a similarly strict fashion. Like @bradennapier said, modules directly imported from this library need to be included as a dependency in your package.json file. |
@data-enabler This issue has been resolved. |
I believe this commit is actually breaking my jest tests. "SyntaxError: Cannot use import statement outside a module" The previous version of react-md-editor (3.23.3) did not have a Also of note: Maybe it's a version mismatch, maybe something else. I'm on Yarn v1.22.19. |
@bradennapier Synchronized the version of |
Worked great! Thank you! |
It is important with yarn v2+ that all your dependencies you use are included in your package.json
By default right now this fails due to a requirement for module
rehype-prism-plus
. That is not in your dependencies. I am guessing it is depended on by another dependency, which is no longer allowed with yarn v2.It would be ideal if y'all could simply add that as a dependency.
Once I did this, everything worked fine with my setup. Thanks!
For those running into this, had to edit
.yarnrc.yml
and have:The text was updated successfully, but these errors were encountered: