0.4.1 • Published 5 years ago

webpack-copy-noloop-plugin v0.4.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

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. If from is file, then to 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 setting move to true. However, you can still use pattern.

waitFor=() => Promise.resolve()

type waitFor = (() => Promise<any>) | number;

Simply delay the copy process due to some reason.

0.4.1

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago