Skip to content

fix: add isClassPrivateMethod() to esm-transformer - #300

Open
nytamin wants to merge 1 commit into
yao-pkg:mainfrom
nytamin:fix/class-private-method
Open

fix: add isClassPrivateMethod() to esm-transformer#300
nytamin wants to merge 1 commit into
yao-pkg:mainfrom
nytamin:fix/class-private-method

Conversation

@nytamin

@nytamin nytamin commented Sep 7, 2026

Copy link
Copy Markdown

Bug fix

This PR adds the check isClassPrivateMethod() to the detectESMFeatures topLevelAwait checks, to exclude private-hashtag-methods from bein considered top-level.

Background

I found a bug where I got the message path/to/file.js has both top-level await and export statements..., even though I had reduced the file in question to be simply:

export class MyClass {
  async #myMethod() {
    await Promise.resolve()
  }
}

Adding parent.isClassPrivateMethod() to the checks fixed the issue for me locally.

To fix a bug where an await in a hastag-private-method resulting in the error message "..has both top-level await and export statements"
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.

1 participant