The code snippet below showcases the solution to our problem by setting the react and dependency paths to the node_modules folder of "myApp". Adding such a field lets us declare how to resolve an arbitrary set of packages by providing a path for each of them (I often use this to override long or unpractical import statements). ![]() Remove haste cache: rm -rf /tmp/haste-map-react-native-packager. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache- or npm start -reset-cache. Delete the nodemodules folder: rm -rf nodemodules & npm install. From its documentation, we can see that Webpack can change how modules are resolved when using the resolve.alias option in a Webpack config. Clear watchman watches: watchman watch-del-all. ![]() To solve this issue, we have to take a look at Webpack. To make this work, we need them to use the same "instance of React". This means that the React context used by "myApp" is different than the one that "myLib" uses to get the theme variable. ![]() In the second case, "myApp" and "myLib" use their own React and Emotion dependencies despite having specified these two as peer dependencies in the package.json of "myLib".Įven if imported, when using React or Emotion within "myLib" we end up using the ones specified as development depencencies. ![]() But the fact is there is no difference between npm install Package Name and npm install Package Name save in the later version after npm 5.0.0 onwards. It has a very frequently used command npm install Package Name save. And that is where we can find the origin of our problem. NPM (Node Package Manager) is the default package manager employed in JavaScript runtime environment in Node.js.
0 Comments
Leave a Reply. |