How to avoid `loaded two copies of React` error when developing an external component?

前端 未结 9 1638
无人共我
无人共我 2020-12-28 14:05

I am developing an external component (let\'s say my-component, which I link to the project with npm link (as it is in process and I need the packa

9条回答
  •  攒了一身酷
    2020-12-28 14:46

    The problem is with npm link. https://github.com/npm/npm/issues/5875

    npm doesn't treat the linked directory as a child of the parent project.

    Try alternatives to npm link:

    1) Use relative path dependencies in package.json

    2) Manually include your dependencies in your projects node_modules directory

    3) Use url path

    Basically anything but npm link

提交回复
热议问题