Open juny1zhang opened 3 years ago
me too
how to solve this error 😭
In an attempt to run the examples in the /examples
directory, I first tried building Draft.js locally, as described in the README.
git clone git@github.com:facebook/draft-js.git
cd draft-js
yarn install
This is when I also encountered this issue:
Unhandled rejection Error in plugin "webpack-stream"
Message:
./lib/DefaultDraftBlockRenderMap.js
Module not found: Error: Can't resolve './react' in '/Users/marius/contrib/draft-js/lib'
resolve './react' in '/Users/marius/contrib/draft-js/lib'
using description file: /Users/marius/contrib/draft-js/package.json (relative path: ./lib)
Field 'browser' doesn't contain a valid alias configuration
using description file: /Users/marius/contrib/draft-js/package.json (relative path: ./lib/react)
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/marius/contrib/draft-js/lib/react doesn't exist
.wasm
Field 'browser' doesn't contain a valid alias configuration
/Users/marius/contrib/draft-js/lib/react.wasm doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
/Users/marius/contrib/draft-js/lib/react.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/marius/contrib/draft-js/lib/react.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/Users/marius/contrib/draft-js/lib/react.json doesn't exist
as directory
/Users/marius/contrib/draft-js/lib/react doesn't exist
[/Users/marius/contrib/draft-js/lib/react]
[/Users/marius/contrib/draft-js/lib/react.wasm]
[/Users/marius/contrib/draft-js/lib/react.mjs]
[/Users/marius/contrib/draft-js/lib/react.js]
[/Users/marius/contrib/draft-js/lib/react.json]
@ ./lib/DefaultDraftBlockRenderMap.js 18:12-30
@ ./lib/Draft.js
After some trial and error that didn't lead (me) too far, I observed that by switching to the latest release (git checkout v0.11.7
) and running yarn install
at that point, everything works as expected.
What I'm sharing here is not an actual solution, but at least a workaround (switch to v0.11.7
first) and a lead: this issue was introduced in one of the 88 commits since v0.11.7
was released.
One more thing worth noticing is that the actual issue is that, in the example of DefaultDraftBlockRenderMap.js
, the
const React = require('react');
in the source is translated to
var React = require("./react");
in the build output. Hope this helps. ✌🏼
Also seeing this error.
October 4th. Issue still persists for build. Can't believe that they didn't fix gulp packaging issue (v0.11.7) works
Changing https://github.com/facebook/draft-js/blob/c9878f6a4bffd3bc0d97224c19e178c7f6765a9e/scripts/module-map.js#L11 to react: 'react'
worked for me.
I got this error message when I try to execute “yarn ”。