From fa4722cba150dd0c19e00dd9bdea24cd0b9024f9 Mon Sep 17 00:00:00 2001 From: janwiebedroid Date: Mon, 7 Nov 2022 20:04:50 +0100 Subject: [PATCH] fix(js): call normalizePath on generated importPath normalizePath is needed to replace the windows style path with a unix style path. Fixes #13011 --- packages/js/src/utils/inline.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/js/src/utils/inline.ts b/packages/js/src/utils/inline.ts index 1cac5cb71690c..952f981265b80 100644 --- a/packages/js/src/utils/inline.ts +++ b/packages/js/src/utils/inline.ts @@ -1,5 +1,5 @@ import type { ExecutorContext, ProjectGraphProjectNode } from '@nrwl/devkit'; -import { readJsonFile } from '@nrwl/devkit'; +import { readJsonFile, normalizePath } from '@nrwl/devkit'; import { copySync, readdirSync, @@ -285,7 +285,11 @@ function recursiveUpdateImport( const fileContent = readFileSync(filePath, 'utf-8'); const updatedContent = fileContent.replace(importRegex, (matched) => { const result = matched.replace(/['"]/g, ''); - return `"${relative(dirPath, inlinedDepsDestOutputRecord[result])}"`; + const importPath = `"${relative( + dirPath, + inlinedDepsDestOutputRecord[result] + )}"`; + return normalizePath(importPath); }); writeFileSync(filePath, updatedContent); } else if (file.isDirectory()) {