Closed alex-dow closed 8 years ago
If I run npm install inside node_modules/my-library everything works as expected. Is there a way to avoid this step?
No, I'd avoid using npm this way for dependencies requiring shimming. As you've discovered, node_modules paths are not guaranteed and hardcoding them breaks. You could consider transforming globally from your app, otherwise you're going to end up with two copies.
well I sort of found a solution, which is to include the missing dependency in "bundledDependencies" of the library project's package.json. This seems to force npm to install what I need.
I have two projects that both need Twitter Bootstrap. The first project is a library, the second project is a webapp that depends on the library. The problem I'm having is this:
In the Library Project, my package.json has this:
Now, in my App Project, I have the EXACT same settings, but here is where the problem arises. In the App Project, it requires() code from the Library Project, which requires('bootstrap'), but it can't find bootstrap, because browserify-shim is looking in the directory relative to the lib project which would be node_modules/my-library and does not have a node_modules folder since npm doesn't install dependencies of dependencies if they are met by the hosting project.
If I run npm install inside node_modules/my-library everything works as expected. Is there a way to avoid this step? Thanks