Skip to content

Commit

Permalink
fix(js): default swcCwd to '.' to prevent ENOENT error when invoking …
Browse files Browse the repository at this point in the history
…swc cli (#9256)

Co-authored-by: Chau Tran <ctran@Chaus-MacBook-Pro.local>
  • Loading branch information
nartc and Chau Tran committed Mar 14, 2022
1 parent 921a9e5 commit 71bd3e1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/js/src/executors/swc/swc.impl.ts
Expand Up @@ -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,
Expand Down

0 comments on commit 71bd3e1

Please sign in to comment.