We have a public react-native
package with some native components inside a sub directory in the same repo /lib
, these native components are also being published.
We need to do some refactoring (internal reasons) and I wonder if it’s possible to use a different version in our devDependencies
and dependencies
? Something like this:
* From what I’ve tested this gives me the public version locally as well.
dependencies": {
"native-lib": "^1.0.0"
},
devDependencies": {
"native-lib": "file:./lib"
},
So our users will get the public version while we can work with the local version while developing?
2
Answers
I do not think it is. Both packages would land in the same folder in node_modules. That should lead to conflict.
But you could perhaps try to install your development version under (slightly) different name?
And then, even if you avoid conflict on a package-manager level, you must reference your dev version differently in your application.
A common approach is to use scripts in your package.json file to install different versions of packages depending on the environment. You can create scripts that install separate dependencies for development and production.