From 466a1910f139b0721de9065c7ae0dfdb2d00483e Mon Sep 17 00:00:00 2001 From: Andrew Stein Date: Fri, 24 May 2019 10:17:34 -0400 Subject: [PATCH] Fix for webpack 4 themes generation error on Windows --- packages/perspective-viewer/src/config/themes.config.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/perspective-viewer/src/config/themes.config.js b/packages/perspective-viewer/src/config/themes.config.js index c1f08bffc2..5211f6afdd 100644 --- a/packages/perspective-viewer/src/config/themes.config.js +++ b/packages/perspective-viewer/src/config/themes.config.js @@ -24,7 +24,10 @@ module.exports = Object.assign({}, common(), { }), new WebpackOnBuildPlugin(() => { for (const theme of THEMES) { - fs.unlinkSync(path.resolve(__dirname, "..", "..", "build", theme.replace("less", "js"))); + const filePath = path.resolve(__dirname, "..", "..", "build", theme.replace("less", "js")); + if (fs.existsSync(filePath)) { + fs.unlinkSync(filePath); + } } }) ], @@ -38,7 +41,7 @@ module.exports = Object.assign({}, common(), { loader: "base64-font-loader" }, { - test: /themes\/.+?\.less$/, + test: /themes[\\/].+?\.less$/, use: [{loader: MiniCssExtractPlugin.loader}, "css-loader", "less-loader"] } ]