Closed jkarsrud closed 9 years ago
The exact code where defeatureify does its namespace.FEATURES.isEnabled()
-checking is here; https://github.com/thomasboyt/defeatureify/blob/master/defeatureify.js#L43-L45
interesting, will see if I could spend some time on this.
@sivakumar-kailasam I plan on working on this and #6 tonight, but we'll see how it goes :)
Awesome, are you still planning to have tests compare generated strings or something like https://github.com/sindresorhus/broccoli-defeatureify/tree/master/fixture ?
That's part of the plan, yes.
Awesome :+1:
The way defeatureify works, is that it parses the code for a given namespace regardless of whether the namespace is defined or not. This means that if you have a namespace that contains dashes (that #7 included), using
window['special-namespace'].FEATURES.isEnabled('a-feature')
won't actually remove the feature from the code (since defeaureify only looks for the namespace). When building in production, this will most likely result in an error, sincewindow['special-namespace']
is undefined.A fix for this might be to camelize the namespace using something like Ember's
String.prototype.camelize
, making a namespace likespecial-namespace
becomespecialNamespace
. This will need to be noted in the readme./cc @sivakumar-kailasam