From 05ad264912b169d86ff503c243940821bb5d7273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=8E=E8=BF=82=E8=BF=82?= Date: Wed, 6 Apr 2022 13:09:28 +0800 Subject: [PATCH] fix: yarn web failed in windows (#719) --- build/gulpfile.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/gulpfile.js b/build/gulpfile.js index 189e82b1d..05713d8ce 100644 --- a/build/gulpfile.js +++ b/build/gulpfile.js @@ -13,7 +13,10 @@ function replacePath(code, filePath, importOptions) { const sourcePath = path.dirname(filePath); const targetPath = path.resolve(output); const relativePath = path.relative(sourcePath, targetPath); - const finalPath = relativePath ? './' + relativePath + '/' : './'; + // transform different platform separator to linux's separator + const finalPath = relativePath + ? './' + relativePath.split(path.sep).join('/') + '/' + : './'; return code.replace(/([from|import]\s+)'(mo\/|\bmo\b)/g, "$1'" + finalPath); }