I've looked around a lot in the last few days ... and I was never able to succeed with this
What I'm trying to achieve: I am developing in a (forked) existing react library and I want to "link" the test project using this library to the development folder of the library, so that every change of the library code will be available inside the test project without the need to build the library first.
This (to me) sounds like something everyone is doing every day. Nevertheless, I'm not able to get it working on my side.
The library has its own dependencies (obviously)
What I did: I tried to use this to link the test project to the library
cd my-test-project
npm link ../my-react-library
Is this a correct step? What else do I need to do in order to be able to use a component from this library in my test project?
EDIT: Ok, I can see the link with npm ls, so I guess it is the right way to start. But what next?
>> npm ls -g --depth=0 --link=true
C:\Users\xxxxxx\AppData\Roaming\npm
├── [email protected] -> .\D:\Project Folders\ReactProjects\my-react-library
└── [email protected] -> .\D:\Project Folders\ReactProjects\...............\node_modules\react
package.jsonofmy-react-librarypoint to the built version in themainormodulefields? If so, you probably also need to changeimportstatements to reach into the module and import individual files from source instead. However, this is a pain. Usually you'd solve this issue differently, by just having a separate build watch process inmy-react-libraryand let the changes propagate. With your link solution that should work fine.node_modulesas its easier (no link, just npm install). If that's impractical for some reason, what you were doing (link it) makes sense. But you'd also need to run the build of the third party library. Check the third party librariesscriptentries inpackage.jsonas there may bewatchoption which makes it less painful. But yeh...hacking innode_modulesgets you quite far.