You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-23Lines changed: 4 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,7 @@ import worker from 'workerize-loader?inline!./worker'
70
70
Type: `String`
71
71
Default: `[hash]`
72
72
73
-
You can pass filename prefix for the compiled worker. Note, that `.worker` suffix will be added automatically
73
+
Customize filename generation for worker bundles. Note that a `.worker` suffix will be injected automatically (`{name}.worker.js`).
74
74
75
75
```js
76
76
// webpack.config.js
@@ -89,7 +89,7 @@ import worker from 'workerize-loader?{"name":"[name].[contenthash:8]"}!./worker'
89
89
Type: `String`
90
90
Default: based on `output.publicPath`
91
91
92
-
You can pass `publicPath` to specify the public URL address of the output files
92
+
Workerize uses the configured value of `output.publicPath`from Webpack unless specified here. The value of `publicPath` gets prepended to bundle filenames to get their full URL. It can be a path, or a full URL with host.
93
93
94
94
```js
95
95
// webpack.config.js
@@ -108,7 +108,7 @@ import worker from 'workerize-loader?{"publicPath":"/static/"}!./worker'
108
108
Type: `Boolean`
109
109
Default: `false`
110
110
111
-
You can pass `ready`to set up a wrapper around the `"ready"` event
111
+
If `true`, the imported "workerized" module will include a `ready`property, which is a Promise that resolves once the Worker has been loaded. Note: this is unnecessary in most cases, since worker methods can be called prior to the worker being loaded.
112
112
113
113
```js
114
114
// webpack.config.js
@@ -126,31 +126,12 @@ let instance = worker() // `new` is optional
When enabled, generated output will create your Workers using a Data URL that loads your code via `importScripts` (eg: `new Worker('data:,importScripts("url")')`). This workaround enables cross-origin script preloading, but Workers are created on an "opaque origin" and cannot access resources on the origin of their host page without CORS enabled. Only enable it if you understand this and specifically need the workaround.
0 commit comments