webpack-copy-noloop-plugin
v0.4.1
Published
## Why
Downloads
8
Readme
webpack-copy-noloop-plugin
Why
When set watch
to true
, won't trigger infinite loop of updates.
Notice
This is for webpack@4
Install
npm i -D webpack-copy-noloop-plugin
# or
yarn add -D webpack-copy-noloop-plugin
Usage
const CopyPlugin = require("webpack-copy-noloop-plugin");
module.exports = {
plugins: [
new CopyPlugin({
list: [
{
from: "dir/or/file",
to: "dir/or/file"
}
]
})
]
};
Config
[root]
new CopyPlugin({
root: __dirname
});
Set the root for the list
config.
If set, then all from
and to
in the list
field will be resolved from root
value.
list
from
type from = string;
Source. Could be file or directory.
to
type to = string;
Destination. Could be file or directory.
Type must match the corresponding
from
. Iffrom
is file, thento
needs to be file. Same applies for directory.
[pattern]
type pattern = RegExp;
If from
is directory then you can use pattern
to match desire files.
[filter]
type filter = (from: string, to: string) => boolean;
Similar to pattern
, but apply for both directory and file.
[flatten = false]
type flatten = boolean;
If from
is directory and using pattern
to filter files, then flatten
could be set to flatten files in to
directory.
[move=false]
type move = boolean;
As the name indicates, whether to move the file/directory or not.
filter
function won't work when settingmove
totrue
. However, you can still usepattern
.
[waitFor=() => Promise.resolve()]
type waitFor = (() => Promise<any>) | number;
Simply delay the copy process due to some reason.