How to find where top level await is used

43 Views Asked by At

My project consists of two parts: module with common functionality and react app, which uses it.

When I import module I get error Module parse failed: The top-level-await experiment is not enabled (set experiments.topLevelAwait: true to enabled it).

Since top-level await isn't really required in the module, I would prefer not to enable this experiment, rather I would like to find and remove it.

Module is built using vite and typescript.

My question is: Is there some ESLint rule or linter or any other tool, that will find exact location in code where top level await occurs? I couldn't find it using simple text search.

EDIT: Turns out that top-level-await was used in package module depends on (pdfjs-dist). So I am also interested into possibility to scan dependencies for use of top-level await.

0

There are 0 best solutions below