Skip to content

Commit 64d26c3

Browse files
committed
[README] Documented new configuration options.
1 parent 9583f59 commit 64d26c3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ dataWorker.postMessage('Hello World!');
4242
The plugin responds to the following configuration options:
4343
```javascript
4444
webWorkerLoader({
45-
targetPlatform?: string, // The platform workers should be built for, can be 'auto', 'browser' or 'node'.
46-
// specifying either 'browser' or 'node' reduces the amount of loader code.
45+
targetPlatform?: string, // The platform workers should be built for, can be 'auto', 'browser', 'node' or 'base64'.
46+
// specifying a target platform other than 'auto' reduces the amount of loader code.
47+
// The `base64` options forces inline and the import results on a base64 string that
48+
// encodes the worker's source code. NOTE: The string does not include a mime type.
49+
// 'auto' detectes the target platform and selects between 'browser` and 'node'.
4750
// Default: 'auto'
4851

4952
pattern?: RegEx, // A RegEx instance describing the pattern that matches the files to import as
@@ -66,6 +69,10 @@ webWorkerLoader({
6669

6770
preserveSource?: boolean, // When inlined and this option is enabled, the full source code is included in the
6871
// built file, otherwise it's embedded as a base64 string. Default: false
72+
73+
preserveFileNames?: boolean, // When code splitting is used (`inline === false`) the input worker file names are
74+
// preserved, if duplicates are found `-n` is appended to the file names.
75+
// Default: false
6976

7077
enableUnicodeSupport?: boolean, // When inlined in Base64 format, this option enables unicode support (UTF16). This
7178
// flag is disabled by default because supporting UTF16 doubles the size of the final
@@ -92,6 +99,8 @@ The `sourcemap` configuration option is ignored when `inline` is set to `false`,
9299

93100
`loadPath` is meant to be used in situations where code-splitting is used (`inline = false`) and the entry script is hosted in a different folder than the worker code.
94101

102+
Setting `targetPlatform` to `'base64'` will ignore the `inline` option and will always inline the resulting code.
103+
95104

96105
### Roadmap
97106
- [x] Bundle file as web worker blob

0 commit comments

Comments
 (0)