remarkjs / react-markdown

Markdown component for React
https://remarkjs.github.io/react-markdown/
MIT License
13.27k stars 876 forks source link

Unable to resolve "devlop" from "node_modules/react-markdown/lib/index.js #801

Closed subraatakumar closed 1 year ago

subraatakumar commented 1 year ago

Initial checklist

Affected packages and versions

"react-markdown": "^9.0.1",

Link to runnable example

No response

Steps to reproduce

I used this package in an expo app. For web it is working fine. But when i am trying to run it on android it shows error:

Android Bundling failed 111ms Unable to resolve "devlop" from "node_modules/react-markdown/lib/index.js"

Expected behavior

should compile properly

Actual behavior

not compiling

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

JounQin commented 1 year ago

duplicate of #798, please search issues before raising.

github-actions[bot] commented 1 year ago

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.

github-actions[bot] commented 1 year ago

Hi! Thanks for taking the time to contribute!

Because we treat issues as our backlog, we close duplicates to focus our work and not have to touch the same chunk of code for the same reason multiple times. This is also why we may mark something as duplicate that isn’t an exact duplicate but is closely related.

Thanks, — bb

github-actions[bot] commented 1 year ago

Hi team! It seems this post is a duplicate, but hasn’t been marked as such. Please post a comment w/ Duplicate of #123(no final .) to do so. See GH docs for more info.

Thanks, — bb

subraatakumar commented 1 year ago

duplicate of #798, please search issues before raising.

I am using it in react native. Can it be actually used in react native or not?

It is working fine for web.

JounQin commented 1 year ago

It depends on your bundler whether it understands exports in package.json correctly.

subraatakumar commented 1 year ago

It depends on your bundler whether it understands exports in package.json correctly.

Ok. Thanks 🙏

ChristianMurphy commented 1 year ago

I am using it in react native. Can it be actually used in react native or not?

It should be possible to build the code with metro/expo, if it does not, that is bug in their build tool. Which expo would be the best place for support on https://github.com/expo/expo/discussions

That said once it builds, the components react-markdown uses are web focused, react-native as its own web-incompatible component system, see these discussions for the rendering side:

holdenmatt commented 11 months ago

(FYI for others) I also ran into this issue when using react-markdown in a chrome extension using Plasmo, which uses Parcel as the bundler.

The fix was to add a line to my package.json as described here: https://parceljs.org/blog/v2-9-0/#new-resolver

(Will no longer be needed after Parcel 3 ships apparently)

zereraz commented 10 months ago

https://parceljs.org/blog/v2-9-0/#new-resolver

This didn't work for me, am building chrome extension with Parcel as bundler as well.

edit: it is working for me now with parcel version 2.11.0, was not working for 2.10.2

Caplost commented 6 months ago

@holdenmatt this work for me 。 just add at package.json file. "@parcel/resolver-default": { "packageExports": true }

radelcom commented 5 months ago

@subraatakumar just curious... as i am also developing web version in an expo app. i am running into this issue and wondering how were you able to get it running in web in an expo app without encountering this issue?

Web Bundling failed 16342ms
Unable to resolve "devlop" from "../../node_modules/react-markdown/lib/index.js"
AlastairTaft commented 5 months ago

I'm using Expo, I'm on version 50 (one behind the latest) I don't know why Metro can't resolve package exports by default but there's an option you can toggle on to enable it.

I had to create a metro.config.js file, import the default Expo metro config and enable the unstable_enablePackageExports option. The file looks like this.

const { getDefaultConfig } = require('expo/metro-config');

const config = getDefaultConfig(__dirname);

config.resolver.unstable_enablePackageExports = true

module.exports = config;
Nithur-M commented 4 months ago

(FYI for others) I also ran into this issue when using react-markdown in a chrome extension using Plasmo, which uses Parcel as the bundler.

The fix was to add a line to my package.json as described here: https://parceljs.org/blog/v2-9-0/#new-resolver

(Will no longer be needed after Parcel 3 ships apparently)

Hey @holdenmatt, were you able to successfully render markdown with this workaround? For me, it only suppresses that error message but not rendering the markdown. Everything is being rendered as plain text.