Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to get it working #1

Merged
merged 1 commit into from
Apr 7, 2019
Merged

Changes to get it working #1

merged 1 commit into from
Apr 7, 2019

Conversation

mrkiffie
Copy link
Contributor

@mrkiffie mrkiffie commented Apr 6, 2019

Hi @sethandleah.

Regarding facebook/react#15315

I was able to get this working with the following steps. I hope this helps in resolving the issue on your side.

  • Remove react from the lib bundle by specifying it as external in webpack.config.js.
  • Fix children reference, replace unused content

Steps to reproduce

  • clone sethandleah/react-lib
  • clone sethandleah/myapp
  • cd myapp
  • npm i
  • cd ../react-lib
  • npm install
  • npm link ../myapp/node_modules/react - important step
  • npm run build - important step
  • npm link
  • cd ../myapp
  • npm link react-lib
  • npm start

To see the above, do the following:

Uncomment these lines at myapp/src/App.js:
import Accordion from './Accordion';
import AccordionItem from './AccordionItem';
The comment out these line, at myapp/src/App.js:
import { Accordion } from 'react-lib';
import { AccordionItem } from 'react-lib';

@sethandleah sethandleah merged commit 047d95c into sethandleah:master Apr 7, 2019
@danydhondt
Copy link

Another way of doing this (I always work with Yarn):

cd to myApp/node_modules/react and run yarn link
then in your library run yarn link react

Then the errors disappear and everything is working ok

@satishdentsu
Copy link

HI @mrkiffie
Above solution will work if React-lib and React-app on local . What we can do if lib is pusblished on npm ? Can you suggest any solution for publish React_lib ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants