Skip to content

Commit

Permalink
docs: issue 408 (#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed Dec 9, 2019
1 parent f6f72a7 commit 51c3680
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -63,7 +63,7 @@ module.exports = {
| Name | Type | Default | Description |
| :-------------------------------: | :-------------------: | :---------------------------------------------: | :---------------------------------------------------------------------------------------------------- |
| [`from`](#from) | `{String\|Object}` | `undefined` | Glob or path from where we сopy files. |
| [`to`](#to) | `{String}` | `undefined` | Output path. |
| [`to`](#to) | `{String}` | `compiler.options.output` | Output path. |
| [`context`](#context) | `{String}` | `options.context \|\| compiler.options.context` | A path that determines how to interpret the `from` path. |
| [`toType`](#totype) | `{String}` | `undefined` | Determinate what is `to` option - directory, file or template. |
| [`test`](#test) | `{RegExp}` | `undefined` | Pattern for extracting elements to be used in `to` templates. |
Expand Down Expand Up @@ -108,7 +108,7 @@ module.exports = {
#### `to`

Type: `String`
Default: `undefined`
Default: `compiler.options.output`

Output path.

Expand Down
1 change: 1 addition & 0 deletions src/index.js
Expand Up @@ -95,6 +95,7 @@ class CopyPlugin {
callback();
});
});

compiler.hooks.afterEmit.tapAsync(plugin, (compilation, callback) => {
logger.debug('starting after-emit');

Expand Down
15 changes: 15 additions & 0 deletions test/to-option.test.js
Expand Up @@ -448,5 +448,20 @@ describe('to option', () => {
.then(done)
.catch(done);
});

it('should move a file to "compiler.options.output" by default', (done) => {
runEmit({
compilation: { output: { path: '/path/to' } },
expectedAssetKeys: ['newfile.txt'],
patterns: [
{
from: 'file.txt',
to: 'newfile.txt',
},
],
})
.then(done)
.catch(done);
});
});
});

0 comments on commit 51c3680

Please sign in to comment.