Closed subraatakumar closed 1 year ago
duplicate of #798, please search issues before raising.
Hi! This was closed. Team: If this was fixed, please add phase/solved
. Otherwise, please add one of the no/*
labels.
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
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
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.
It depends on your bundler whether it understands exports
in package.json
correctly.
It depends on your bundler whether it understands
exports
inpackage.json
correctly.
Ok. Thanks 🙏
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:
(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)
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
@holdenmatt this work for me 。 just add at package.json file. "@parcel/resolver-default": { "packageExports": true }
@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"
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;
(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.
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