diff --git a/packages/ember-css-modules/lib/htmlbars-plugin/index.js b/packages/ember-css-modules/lib/htmlbars-plugin/index.js index 783ca34..c9d510c 100644 --- a/packages/ember-css-modules/lib/htmlbars-plugin/index.js +++ b/packages/ember-css-modules/lib/htmlbars-plugin/index.js @@ -62,7 +62,7 @@ module.exports = class ClassTransformPlugin { } transformStatement(node) { - if (node.path.original === 'local-class') { + if (!this.isNodePathLiteral(node.path) && node.path.original === 'local-class') { this.transformLocalClassHelperInvocation(node); } else { this.transformPossibleComponentInvocation(node); @@ -70,7 +70,7 @@ module.exports = class ClassTransformPlugin { } transformSubexpression(node) { - if (node.path.original === 'local-class') { + if (!this.isNodePathLiteral(node.path) && node.path.original === 'local-class') { this.transformLocalClassHelperInvocation(node); } } @@ -245,4 +245,14 @@ module.exports = class ClassTransformPlugin { return parts; } + + isNodePathLiteral(path) { + return { + StringLiteral: true, + BooleanLiteral: true, + NumberLiteral: true, + UndefinedLiteral: true, + NullLiteral: true + }[path.type] ?? false; + } };