I’ve got multiple local packages that are stored outside of my app, and I reference them via the METEOR_PACKAGE_DIRS environment variable. I’ve recently started separating some out that have React components. I use tmeasday:check-npm-versions
to declare react
as a peer dependency. Then, I’ve put react
as a peer dependency, and as a dev dependency (because I’m using storybook to test the components) in package.json
. I’m only using ES6 import style to import react and whatever else from npm.
Within the package, this works great.
The problem is that when I load the package via the main Meteor app, it loads up the node_modules files in that package’s directory, along with the node_modules in the app directory. This causes the application to have two copies of React, and it bombs because that’s no good.
When I remove the node_modules directory from the package, everything is great in the main app. But then when I go back to the package, I have to run npm install
to get the libs for things like storybook, or even my eslint libraries, and the node_modules directory comes back and somehow the main app bundles that up (even though it’s supposed to ignoring node_modules
from what I understand).
Anyone else have a similar setup or know any way to get Meteor to ignore the node_modules directory from a local package?