From 4d261d8bec7a779a23c64fb1d6e6b4c6c78b7ba5 Mon Sep 17 00:00:00 2001 From: Tom Schalken Date: Mon, 14 Dec 2020 15:03:49 +0100 Subject: [PATCH] cleaner copyPlugin in webpack config --- app/templates/webpack.config.js | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/app/templates/webpack.config.js b/app/templates/webpack.config.js index 7883852..eaf7c6d 100755 --- a/app/templates/webpack.config.js +++ b/app/templates/webpack.config.js @@ -115,23 +115,15 @@ module.exports = { }), // copy the rest of the unprocessed files - new CopyPlugin([ - // Loose svg's - { - from: `${paths.source + paths.folders.svg}`, - to: paths.folders.svg.replace('/', ''), - }, - // Loose images - { - from: `${paths.source + paths.folders.images}`, - to: paths.folders.images.replace('/', ''), - }, - // fonts - { - from: `${paths.source + paths.folders.fonts}`, - to: paths.folders.fonts.replace('/', ''), - }, - ]), + new CopyPlugin( + ['svg', 'images', 'fonts'] + .map(entry => ( + { + from: `${paths.source + paths.folders[entry]}`, + to: paths.folders[entry].replace('/', ''), + } + )) + ), new WebpackNotifierPlugin({ title: 'Webpack',