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 4081325d50b..27a860c34e5 100644 --- a/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb +++ b/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb @@ -70,7 +70,9 @@ module Tilt # For backwards compatibility with plugins, for now export the Global format too. # We should eventually have an upgrade system for plugins to use ES6 or some other # resolve based API. - if ENV['DISCOURSE_NO_CONSTANTS'].nil? && scope.logical_path =~ /(discourse|admin)\/(controllers|components|views|routes|mixins|models)\/(.*)/ + if ENV['DISCOURSE_NO_CONSTANTS'].nil? && + scope.logical_path =~ /(discourse|admin)\/(controllers|components|views|routes|mixins|models)\/(.*)/ + type = Regexp.last_match[2] file_name = Regexp.last_match[3].gsub(/[\-\/]/, '_') class_name = file_name.classify @@ -81,7 +83,7 @@ module Tilt end require_name = module_name(scope.root_path, scope.logical_path) - if require_name !~ /\-test$/ + if require_name !~ /\-test$/ && require_name !~ /^discourse\/plugins\// result = "#{class_name}#{type.classify}" # HAX