Skip to content

Commit ff0c736

Browse files
refactor: tests (#393)
1 parent 7f08be6 commit ff0c736

File tree

5 files changed

+487
-401
lines changed

5 files changed

+487
-401
lines changed

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ module.exports = {
6868
| [`force`](#force) | `{Boolean}` | `false` | Overwrites files already in `compilation.assets` (usually added by other plugins/loaders). |
6969
| [`ignore`](#ignore) | `{Array}` | `[]` | Globs to ignore files. |
7070
| [`flatten`](#flatten) | `{Boolean}` | `false` | Removes all directory references and only copies file names. |
71-
| [`transform`](#transform) | `{Function\|Promise}` | `undefined` | Allows to modify the file contents. |
7271
| [`cache`](#cache) | `{Boolean\|Object}` | `false` | Enable `transform` caching. You can use `{ cache: { key: 'my-cache-key' } }` to invalidate the cache. |
72+
| [`transform`](#transform) | `{Function\|Promise}` | `undefined` | Allows to modify the file contents. |
7373
| [`transformPath`](#transformPath) | `{Function\|Promise}` | `undefined` | Allows to modify the writing path. |
7474

7575
#### `from`
@@ -324,14 +324,13 @@ module.exports = {
324324
};
325325
```
326326

327-
#### `transform`
328-
329-
Type: `Function|Promise`
330-
Default: `undefined`
327+
#### `cache`
331328

332-
Allows to modify the file contents.
329+
Type: `Boolean|Object`
330+
Default: `false`
333331

334-
##### `{Function}`
332+
Enable/disable `transform` caching. You can use `{ cache: { key: 'my-cache-key' } }` to invalidate the cache.
333+
Default path to cache directory: `node_modules/.cache/copy-webpack-plugin`.
335334

336335
**webpack.config.js**
337336

@@ -345,13 +344,21 @@ module.exports = {
345344
transform(content, path) {
346345
return optimize(content);
347346
},
347+
cache: true,
348348
},
349349
]),
350350
],
351351
};
352352
```
353353

354-
##### `{Promise}`
354+
#### `transform`
355+
356+
Type: `Function|Promise`
357+
Default: `undefined`
358+
359+
Allows to modify the file contents.
360+
361+
##### `{Function}`
355362

356363
**webpack.config.js**
357364

@@ -363,21 +370,15 @@ module.exports = {
363370
from: 'src/*.png',
364371
to: 'dest/',
365372
transform(content, path) {
366-
return Promise.resolve(optimize(content));
373+
return optimize(content);
367374
},
368375
},
369376
]),
370377
],
371378
};
372379
```
373380

374-
#### `cache`
375-
376-
Type: `Boolean|Object`
377-
Default: `false`
378-
379-
Enable/disable `transform` caching. You can use `{ cache: { key: 'my-cache-key' } }` to invalidate the cache.
380-
Default path to cache directory: `node_modules/.cache/copy-webpack-plugin`.
381+
##### `{Promise}`
381382

382383
**webpack.config.js**
383384

@@ -389,9 +390,8 @@ module.exports = {
389390
from: 'src/*.png',
390391
to: 'dest/',
391392
transform(content, path) {
392-
return optimize(content);
393+
return Promise.resolve(optimize(content));
393394
},
394-
cache: true,
395395
},
396396
]),
397397
],

0 commit comments

Comments
 (0)