From 9249566a71b9ee81e8f5c9c4a692de572b19aadd Mon Sep 17 00:00:00 2001 From: Chau Tran Date: Wed, 9 Mar 2022 12:16:52 -0600 Subject: [PATCH] fix(js): default swcCwd to '.' to prevent ENOENT error when invoking swc cli --- packages/js/src/executors/swc/swc.impl.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/js/src/executors/swc/swc.impl.ts b/packages/js/src/executors/swc/swc.impl.ts index 7ca464435ee5d..0b860dc195c9f 100644 --- a/packages/js/src/executors/swc/swc.impl.ts +++ b/packages/js/src/executors/swc/swc.impl.ts @@ -42,7 +42,9 @@ function normalizeOptions( // We pop the last part of the `projectRoot` to pass // the last part (projectDir) and the remainder (projectRootParts) to swc const projectDir = projectRootParts.pop(); - const swcCwd = projectRootParts.join('/'); + // default to current directory if projectRootParts is []. + // Eg: when a project is at the root level, outside of layout dir + const swcCwd = projectRootParts.join('/') || '.'; const swcCliOptions = { srcPath: projectDir,