FIX: Don't add constants for ES6 modules in plugins
If you're using ES6 in a plugin, you shouldn't be depending on the backwards compatibility layer. That's for proper Discourse only.
This commit is contained in:
parent
d0630b7f26
commit
9a07945a16
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue