From 196549c12413817dd6fed2f83784cb709e29e5d3 Mon Sep 17 00:00:00 2001 From: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com> Date: Mon, 21 Nov 2022 20:03:19 +0530 Subject: [PATCH] Adds windows compatibility for copywebpackplugin (#5602) * adds windows compatibility * Revert unintentional change --- apps/web/next.config.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/web/next.config.js b/apps/web/next.config.js index 5254ae6af8..0c45ad0e90 100644 --- a/apps/web/next.config.js +++ b/apps/web/next.config.js @@ -99,8 +99,14 @@ const nextConfig = { { from: "../../packages/app-store/**/static/**", to({ context, absoluteFilename }) { - const appName = /app-store\/(.*)\/static/.exec(absoluteFilename); - return Promise.resolve(`${context}/public/app-store/${appName[1]}/[name][ext]`); + // Adds compatibility for windows path + const absoluteFilenameWin = absoluteFilename.replaceAll("\\", "/"); + // Adds compatibility for windows path + const normalizedContext = context.replaceAll("\\", "/"); + const appName = + /app-store\/(.*)\/static/.exec(absoluteFilename) || + /app-store\/(.*)\/static/.exec(absoluteFilenameWin); + return Promise.resolve(`${normalizedContext}/public/app-store/${appName[1]}/[name][ext]`); }, }, ],