From 9c241acff86c2f4d66825c38f4e94902fa62471d Mon Sep 17 00:00:00 2001 From: Maksim Eltyshev Date: Wed, 22 Feb 2023 19:59:40 +0100 Subject: [PATCH] fix: Fix paths in css files when building on windows --- client/config-overrides.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/config-overrides.js b/client/config-overrides.js index 53ef3908..2ea9da5d 100644 --- a/client/config-overrides.js +++ b/client/config-overrides.js @@ -22,7 +22,9 @@ const replaceBaseUrl = (compiler) => { if (info.content.indexOf(BASE_URL_PLACEHOLDER) >= 0) { if (/\.css$/.exec(info.targetPath)) { // For CSS 'url(...)' import we can use relative import - const relPath = path.relative(path.dirname(info.targetPath), info.outputPath); + const relPath = path + .relative(path.dirname(info.targetPath), info.outputPath) + .replace(/\\/g, '/'); replaceInFile(info.targetPath, BASE_URL_PLACEHOLDER, `${relPath}/`); } else if (/\.js$/.exec(info.targetPath)) { // For JS 'import ... from "some-asset"' we can get the variable injected in the window object