[copy-webpack-plugin] Upgrade to v4.4.1 from v4.0.1

This commit is contained in:
mtgto
2018-02-12 14:36:17 +09:00
parent 2ce8fd26ba
commit 11f5627eca
2 changed files with 24 additions and 1 deletions

View File

@@ -51,6 +51,21 @@ const c: Configuration = {
to: 'directory/with/extension.ext',
toType: 'dir'
},
// transform and cache (cache is always used with transform option).
{
from: 'src/*.png',
to: 'dest/',
transform: (content, path) => content,
cache: true
},
// Copy glob results (without dot files) to {output}/to/directory/
{
from: '**/*.png',
fromArgs: { dot: false },
to: 'to/directory'
},
], {
ignore: [
// Doesn't copy any files with a txt extension

View File

@@ -1,4 +1,4 @@
// Type definitions for copy-webpack-plugin v4.0.0
// Type definitions for copy-webpack-plugin v4.4.1
// Project: https://github.com/kevlened/copy-webpack-plugin
// Definitions by: flying-sheep <https://github.com/flying-sheep>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -10,9 +10,15 @@ interface MiniMatchGlob extends IOptions {
glob: string
}
interface MiniMatchOptions extends IOptions {
cwd?: string
}
interface CopyPattern {
/** File source path or glob */
from: string | MiniMatchGlob
/** See the `node-glob` options in addition to the ones below. (default: `{ cwd: context }`) */
fromArgs?: MiniMatchOptions
/**
* Path or webpack file-loader patterns. defaults:
* output root if `from` is file or dir.
@@ -38,6 +44,8 @@ interface CopyPattern {
ignore?: Array<string | MiniMatchGlob>
/** Function that modifies file contents before writing to webpack. (default: `(content, path) => content`) */
transform?: (content: string, path: string) => string
/** Enable transform caching. You can use `{ cache: { key: 'my-cache-key' } }` to invalidate the cache. (default: `false`) */
cache?: boolean | { key: string }
/** Overwrites files already in `compilation.assets` (usually added by other plugins; default: `false`) */
force?: boolean
}