See package changes after code change


Hey guys,

I’m studying Atom Package development, I made a change on the menu of the package but it just show up after I restart Atom.

Is there a better way to see the changes I made in the package code ?


Do you mean you made the change to the source code, or programmatically while the package was running? If the first, then reloading your package is the only way to see changes. How easy it is to do depends on the complexity of your package (and how well it cleans itself up).


Changes to stylesheets will be reloaded automatically, but code changes are not - you need to reload the Atom window for new code take effect. Executing Window: Reload from the command palette is a nice, relatively quick way to iterate, rather than restarting Atom entirely.


Wouldn’t disabling the package and then loading it again be the new version? (I’ve always reloaded Atom, so I don’t actually know).


I just gave it a shot and it didn’t work for our package. Node caches required modules, so I’m guessing that a disable/enable didn’t flush that cache. It may be possible to evict entries from the require cache manually as well… ?

In any case, there are a lot of edge cases related to event handlers and subscriptions being cleaned up properly that could cause your package to behave in odd ways without a nice, full reload to start from a clean slate. It feels like it’s probably going to cause less pain to do a window reload in the end. (Although there may be value in seeing the weird behavior to make sure you’re cleaning up properly on deactivate!)