   mod = config.modules
   normalized.modules = {}
   sourceURLs = mod.addSourceURLs and not config.optimize
-  normalized.modules.wrapper = normalizeWrapper mod.wrapper, sourceURLs
+  normalized.modules.wrapper = normalizeWrapper mod.wrapper, sourceURLs, config.modules.nameCleaner
   normalized.modules.definition = normalizeDefinition mod.definition
   normalized.conventions = {}
   Object.keys(config.conventions).forEach (name) ->

});
"""

normalizeWrapper = (typeOrFunction, addSourceURLs) ->
  switch typeOrFunction
    when 'commonjs' then commonJsWrapper addSourceURLs
    when 'amd'
      (fullPath, data) ->
        path = cleanModuleName fullPath
        """
define('#{path}', ['require', 'exports', 'module'], function(require, exports, module) {
#{data}

  modules              = config.modules      ?= {}
  modules.wrapper     ?= 'commonjs'
  modules.definition  ?= 'commonjs'
  modules.nameCleaner ?= (path) ->
    path.replace(new RegExp('^' + sysPath.relative(paths.root, paths.app) + '/'), '')

  config.server       ?= {}
  config.server.base  ?= ''
