  as it does not contain package.json (#{err})"
   # TODO: test if `brunch-plugin` is in dep’s package.json.
   loadDeps = (deps, isDev) ->
+    requireModule = (depPath, dependencyName) ->
+      plugin = require depPath
+      plugin.brunchPluginName = dependencyName
+      plugin
     deps
       .filter (dependency) ->
         dependency isnt 'brunch' and dependency.indexOf('brunch') isnt -1

  # Load config, get brunch packages from package.json.
  helpers.loadConfig options.config, configParams, (error, config) ->
    joinConfig = config._normalized.join
    plugins    = getPlugins packages, config

    plugins = plugins.filter (plugin) ->
      plugin.optimize ?= plugin.minify if typeof plugin.minify is 'function'
      plugin.defaultEnv ?= if not config.optimize and typeof plugin.optimize is 'function'
        'production'
      else
        '*'

        depPath = "#{nodeModules}/#{dependency}"
        if isDev
          try
            requireModule depPath, dependency
          catch e
            null
        else
          try
            requireModule depPath, dependency
          catch error
            throw new Error "You probably need to execute `npm install` to install brunch plugins. #{error}"
  plugins = loadDeps(Object.keys json.dependencies)
