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
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,8 +68,8 @@ module.exports = {
68
68
|[`force`](#force)|`{Boolean}`|`false`| Overwrites files already in `compilation.assets` (usually added by other plugins/loaders). |
69
69
|[`ignore`](#ignore)|`{Array}`|`[]`| Globs to ignore files. |
70
70
|[`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. |
72
71
|[`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. |
73
73
|[`transformPath`](#transformPath)|`{Function\|Promise}`|`undefined`| Allows to modify the writing path. |
74
74
75
75
#### `from`
@@ -324,14 +324,13 @@ module.exports = {
324
324
};
325
325
```
326
326
327
-
#### `transform`
328
-
329
-
Type: `Function|Promise`
330
-
Default: `undefined`
327
+
#### `cache`
331
328
332
-
Allows to modify the file contents.
329
+
Type: `Boolean|Object`
330
+
Default: `false`
333
331
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`.
335
334
336
335
**webpack.config.js**
337
336
@@ -345,13 +344,21 @@ module.exports = {
345
344
transform(content, path) {
346
345
returnoptimize(content);
347
346
},
347
+
cache:true,
348
348
},
349
349
]),
350
350
],
351
351
};
352
352
```
353
353
354
-
##### `{Promise}`
354
+
#### `transform`
355
+
356
+
Type: `Function|Promise`
357
+
Default: `undefined`
358
+
359
+
Allows to modify the file contents.
360
+
361
+
##### `{Function}`
355
362
356
363
**webpack.config.js**
357
364
@@ -363,21 +370,15 @@ module.exports = {
363
370
from:'src/*.png',
364
371
to:'dest/',
365
372
transform(content, path) {
366
-
returnPromise.resolve(optimize(content));
373
+
returnoptimize(content);
367
374
},
368
375
},
369
376
]),
370
377
],
371
378
};
372
379
```
373
380
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`.
0 commit comments