[SOLVED] Watch addon directory for changes

I have an addon I’m working on in node_modules/ember-cli-addon-name.

How do I tell Brocfile.js to add that directory to the list of watched dirs for live-reload? It’s a real pain to need to stop/start ember-cli every time I update something in it.

For dev purposes, you could move that code to your vendor file. If its an asset that you’re actively changing then thats where you might want to keep it anyway.

Hi Joseph. I’m not pretty sure what do you mean by moving the asset to vendor file.

To clarify, what I’m trying to achieve is find the best workflow for a multiple apps with shared repositories of addons. Keeping them all in a single file does not seem right to me.

I ended up working on addon as a standalone package (hosting and testing via ember-cli server) linked with my applications with npm link.

This is documented here:

1 Like

@WooDzu I’m using the same method to contribute to an open source add-on. It seems npm link works great, but I couldn’t find anything about adding the folder to the live-reload watch directories so I need to restart the server for each change. How did you get this working/add the watch folder outside of the project’s directory?

The vendor directory hack is less than ideal unless you can somehow tell the ember-cli to look for properly structured add-ons/git repos in that directory.

Hi @SimonKaluza,

No magic here, I went the recommended way:

ember addon my-addon
cd my-addon
ember serve

Doing development in this standalone addon (with livereload) and QA from within ember-cli project (no live-reload). I have actually got used to it now but still think that livereload that watches addon’s changes from withing project would be great!

Ahhh I gotcha WooDzu. Thanks for clarifying.

Maybe I’ll try that then make symbolic links or something from the addon directory to the actual github project or something similar. Maybe one of us should make an issue on the Ember-CLI github issue tracker, as this works great for doing your own custom addon, but I’m just making contributions/forking an already existing plugin. Juggling versions and dependencies between the various branches I’m working has proven to be difficult and confusing.

1 Like

This is now possible:

// addon index.js
isDevelopingAddon: function() {
  return true;
}

github.com/ember-cli/ember-cli/blob/master/ADDON_HOOKS.md#isdevelopingaddon

@mcm Is this still working for you as of 1.13.1?

Apparently it’s a bug in the watchman setup: https://github.com/ember-cli/ember-cli/issues/4289.