Skip to content

Conversation

@bizob2828
Copy link
Contributor

I was trying to transform a CJS module where I had defined the class as

module.exports = class MyClass {
  constructor() {
    this.name = 'MyClass';
  }
};

I found it was not working as expected. It did work if I defined it as

class MyClass {
  constructor() {
    this.name = 'MyClass';
  }
}

module.exports = MyClass;

I realized after using AST Explorer that the first example was not being transformed correctly because it was not recognizing the class declaration but instead a class expression.

@bizob2828 bizob2828 requested a review from timfish June 10, 2025 15:20
@timfish timfish merged commit 77f1df7 into apm-js-collab:main Jun 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants