0

I am trying to contribute to an npm package (react-draft-wysiwyg) but keep getting (what i think are) Webpack errors.

First i try to click the embed button of draft-js and it errors saying "block is not a BlockNode" - then i follow blogs/posts like this https://github.com/facebook/draft-js/issues/1763 i match peer dependencies and main project pkg json dependencies to draft-js v0.10.4, re-yarn and it says

Element ref was specified as a string (editorContainer) but no owner was set. This could happen for one of the following reasons:

1. You may be adding a ref to a function component
2. You may be adding a ref to a component that was not created inside a component's render method
3. You have multiple copies of React loaded

So in my project's webpack.config.js i have:

alias: {
        react: path.resolve('node_modules/react'),
        modules: [path.resolve(__dirname, "app"), "node_modules"],
      },

I really think these issues are stemming from the webapp trying to pull in different versions of react from the local yarn link'd one.

How do i tell Webpack to only ever use top-level, over everything else?

Help?

Aid19801
  • 1,175
  • 1
  • 17
  • 30
  • `npm ls draft-js`, show what you get. – PlayMa256 Jan 30 '19 at 16:10
  • thanks @PlayMa256 - i get the following... ``` ➜ cms git:(master) ✗ npm ls draft-js ui-comps@0.1.0 /Users/adrianthompson/Documents/proj/cms ├── draft-js@0.10.5 ├─┬ react-draft-wysiwyg@1.13.0 -> /Users/adrianthompson/Desktop/local-packages/react-draft-wysiwyg │ └── draft-js@0.10.4 extraneous └─┬ react-rte@0.16.1 └── draft-js@0.10.5 deduped npm ERR! extraneous: draft-js@0.10.4 /Users/adrianthompson/Documents/proj/cms/node_modules/react-draft-wysiwyg/node_modules/draft-js ``` – Aid19801 Jan 30 '19 at 16:13
  • As i expected it is not webpack faults, it is npm fault. Try running npm dedupe then see if 0.10.5 is the only one. That happened with webpack as well unfortunately – PlayMa256 Jan 30 '19 at 16:38

0 Answers0