reactioncommerce / reaction-cli

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

plugin-loader rerun on reload #16

Open aaronjudd opened 7 years ago

aaronjudd commented 7 years ago

As a developer, I wish that when the application reload or startup processes exit with Unable to resolve some modules:, the plugin-loader would rerun.

You can replicate this behaviour by switching branches where a new plugin has been added, while you have a running application. ie, switch from development to ek-email-templates (as of 0.17.0).

Example error:

=> Server modified -- restarting...
Unable to resolve some modules:

  "/imports/plugins/included/email-templates/server" in
/Users/aaronjudd/ongoworks/reaction/server/plugins.js (os.osx.x86_64)
  "/imports/plugins/included/email-templates/register.js" in
/Users/aaronjudd/ongoworks/reaction/server/plugins.js (os.osx.x86_64)
jshimko commented 7 years ago

Yeah... I wish that was possible too. The only reason that's not the default behavior is because it would require having the plugin loader built into the Meteor build tool (which was not an easy endeavor at all). I originally got around that by having the plugin loader run in a Meteor.startup callback within Reaction, but that came with its own set of issues (like the app reloading after the new files were generated).

So, I'm not sure what the best answer is here. The current state requires you to restart the app after adding/removing an entire plugin directory, but that also allows the plugin loader to be completely separate from the Meteor build tool (definitely ideal). We can build a Meteor build tool plugin, but that's going to require some significant engineering effort. Stopping and restarting the app was/is the reasonable compromise to that excessive effort.

So in short... it can happen, but it's going to be a bit of a project.