-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Getting errors like this:
TypeError: Cannot read properties of undefined (reading 'text')
at NodeObject.getText (evalmachine.<anonymous>:144243:29)
at visitor (/home/colin/filerepo/node_modules/ts-transform-css-modules/dist/transform.js:72:33)
...
Based on this StackOverflow answer, this seems to resolve the issue in my case:
diff --git a/src/transform.ts b/src/transform.ts
index 794b9f9..2978a85 100644
--- a/src/transform.ts
+++ b/src/transform.ts
@@ -145,7 +145,7 @@ function visitor(
}
} else if (ts.isCallExpression(node)) {
if (
- node.expression.getText() === "require" &&
+ ts.isIdentifier(node.expression) && node.expression.escapedText === "require" &&
CSS_EXTENSION_REGEX.test(node.arguments[0].getText())
) {
cssPath = resolveCssPath(Metadata
Metadata
Assignees
Labels
No labels