This imaginary repo is made to analyze the #11277 Github Issue.
In this repo, you have the main react application my-app and a component library my-lib, which for now only has a <Button> component.
The component library is used inside my-app.
- Run
yarn installin both directories,/my-lib/and/my-app/. - Inside
/my-lib/, runyarn linkto create a symlink. - Then run inside
/my-app/theyarn link @my-lib/applecommand to add the symlink to the my-app
Now that everything is setup, we can see both scenarios where one succeeds and one fails.
Bundle my-lib once, with running yarn build once inside its directory. The my-lib/lib should have updated files.
Now, run yarn start inside the my-app directory and you should see that the button is correctly imported without any webpack issue.
It is now also possible to repeatedly run yarn build inside my-lib and the react application should auto reload with the changes.
Bundle my-lib once, with running yarn dev once inside its directory (You may optionally add the -w flag ). The my-lib/lib should have updated files.
Now, run yarn start inside the my-app directory and you should see that an error starting with TypeError: __webpack_modules__[moduleId] is not a function.