I'm playing with react, trying to create many mini apps exploring different react feature. Creating a new react project and installing the same packages over and over again seems to be too much.
Is there a way to reuse the same node modules for a different project? This is what I think I want
/node_modules
/project1
- package.json - where I run npm start from
/project2
- package.json - where I run npm start from
/project3
- package.json - where I run npm start from
From my google research, I've tried having this on every package.json
but it doesn't work
"scripts": {
"dev": "NODE_PATH=$HOME/to/my/parent/folder/node_modules/",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Is there a way to do it?
Top comments (4)
Look into lerna.
I will thanks
Apparently though, when I ran
npm run eject
on the created react application it solved the problemIt be cool if lerna fixes this issue without ejecting. I'll try it
I didn't try but probably you can put a symlink to another node project's node_modules/someModule in your own project?
I think you should just have a single app that’s separated into different parts, one for each experiment.