Skip to content

Commit 3fceb14

Browse files
malta895patak-dev
andauthored
docs: add warning on Worker import with constructor limitations (#15436)
Co-authored-by: patak <[email protected]>
1 parent 4d9363a commit 3fceb14

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/guide/features.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,8 @@ const worker = new Worker(new URL('./worker.js', import.meta.url), {
614614
})
615615
```
616616

617+
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).
618+
617619
### Import with Query Suffixes
618620

619621
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:

0 commit comments

Comments
 (0)