Deref dedupe template module when module fn is called.

From what I can tell the `DedupePlugin` is templating a module and using a template module that isn't in `modules` yet resulting in an undefined function that it tries to call.