Skip to content

Commit

Permalink
docs: add warning on Worker import with constructor limitations (#15436)
Browse files Browse the repository at this point in the history
Co-authored-by: patak <matias.capeletto@gmail.com>
  • Loading branch information
malta895 and patak-dev committed Jan 26, 2024
1 parent 4d9363a commit 3fceb14
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/guide/features.md
Expand Up @@ -614,6 +614,8 @@ const worker = new Worker(new URL('./worker.js', import.meta.url), {
})
```

The worker detection will only work if the `new URL()` constructor is used directly inside the `new Worker()` declaration. Additionally, all options parameters must be static values (i.e. string literals).

### Import with Query Suffixes

A web worker script can be directly imported by appending `?worker` or `?sharedworker` to the import request. The default export will be a custom worker constructor:
Expand Down

0 comments on commit 3fceb14

Please sign in to comment.