diff --git a/src/preProcessPattern.js b/src/preProcessPattern.js index 76c3404b..787fd91b 100644 --- a/src/preProcessPattern.js +++ b/src/preProcessPattern.js @@ -12,7 +12,9 @@ export default function preProcessPattern(globalRef, pattern) { const {info, debug, warning, context, fileDependencies, contextDependencies, compilation} = globalRef; - pattern = _.cloneDeep(pattern); + pattern = typeof pattern === 'string' ? { + from: pattern + } : _.cloneDeep(pattern); pattern.to = pattern.to || ''; pattern.context = pattern.context || context; if (!path.isAbsolute(pattern.context)) { diff --git a/tests/index.js b/tests/index.js index 22810fed..3c5b9ed0 100644 --- a/tests/index.js +++ b/tests/index.js @@ -1053,6 +1053,25 @@ describe('apply function', () => { }); }); + describe('with simple string patterns', () => { + it('can move multiple files', (done) => { + runEmit({ + expectedAssetKeys: [ + 'binextension.bin', + 'file.txt', + 'noextension' + ], + patterns: [ + 'binextension.bin', + 'file.txt', + 'noextension' + ] + }) + .then(done) + .catch(done); + }); + }); + describe('options', () => { describe('ignore', () => { it('ignores files when from is a file', (done) => {