reactioncommerce / reaction-cli

A command line tool for working with Reaction Commerce.
33 stars 20 forks source link

Plugin level package.json with React dependency causes issues. #32

Open mikemurray opened 7 years ago

mikemurray commented 7 years ago

reaction cli npm installs if it detects a package.jsoninside a plugin which is good. However, if something like react is installed in the local node_modules of a plugin then things go crazy when imported. Like the highlander, there can only be one.

Maybe theres a way to install some node modules to the root app node_modules so that we can avoid duplicate, conflicting modules.

I attempted to do so with script in the install script for npm like so:

inside /imports/plugins/custom/my-plugin package.json

"scripts": {
  "install": "node scripts/install.js"
}

scripts/install.js

exec("npm install --prefix ../../../../../ install some-package");

Which seems to trigger on install when running reaction with reaction-cli. However, it's feels kinda brittle to do a npm install --prefix ../../../../../ install some-package if we were to ever move. And symlink plugins would require more path resolution logic.

aaronjudd commented 7 years ago

How do you know it's gone rogue? Is there a specific error in a console, or is this silent failure?