From e34c7ca438c603c46060577548fd166457b4d6e5 Mon Sep 17 00:00:00 2001 From: Johannes Maas Date: Fri, 12 Jun 2020 12:20:22 +0200 Subject: [PATCH] Fix static folder destination on Windows On Windows, a file in static/file.txt was put into dist/static/file.txt instead of dist/file.txt. This was because we cut off everything before the first "/" in the target path string, but Windows separates folders with "\". Instead, we can use the somewhat hidden context feature from the CopyPlugin to get rid of the static/ prefix. See https://webpack.js.org/plugins/copy-webpack-plugin/#from-is-a-glob --- generator/src/develop.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/generator/src/develop.js b/generator/src/develop.js index faf81bd3..77473f4f 100644 --- a/generator/src/develop.js +++ b/generator/src/develop.js @@ -151,11 +151,10 @@ function webpackOptions( new AddFilesPlugin(), new CopyPlugin([ { - from: "static/**/*", - transformPath(targetPath, absolutePath) { - // TODO this is a hack... how do I do this with proper config of `to` or similar? - return targetPath.substring(targetPath.indexOf("/") + 1); - } + // from inside the static folder + context: "static/", + // copy everything + from: "**/*", } ]), new CopyPlugin([