Skip to content

Commit

Permalink
docs: add top level await pitfall
Browse files Browse the repository at this point in the history
  • Loading branch information
Priestch committed Feb 28, 2024
1 parent 921e87d commit 274a55c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/pitfalls.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,11 @@ Although the explicit error may annoy developer at first, it does save your time

You can try to use the methods mentioned in the official FAQ to resolve the issue, or you can try the [`@document-kits/viewer`](https://priestch.github.io/document-viewer), it has
a `disableCORSCheck` option to disable the CORS check for quick start. Be careful, you should not enable this option in production if you don't know what it means.

### Top-level await is not available in the configured target environment

The reason for this error is that the source code of `pdf.js` contains `top-level await` statement, when used and bundled
in a project, it may cause the error. As I commented in the issue https://github.com/mozilla/pdf.js/issues/17245#issuecomment-1918453195,
it can be resolved add/modify related gulp task.

A good article about `top-level await` is [here](https://github.com/orgs/web-infra-dev/discussions/9).

0 comments on commit 274a55c

Please sign in to comment.