diff --git a/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb b/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb index 7103e412665..8e558ea2ca0 100644 --- a/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb +++ b/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb @@ -77,7 +77,8 @@ module Tilt if file_name.end_with?('s') && (!class_name.end_with?('s')) class_name << "s" end - @output << "\n\nDiscourse.#{class_name}#{type.classify} = require('#{scope.logical_path}').default" + require_name = module_name(scope.root_path, scope.logical_path) + @output << "\n\nDiscourse.#{class_name}#{type.classify} = require('#{require_name}').default" end @output