swc-project / swc-node

Faster ts-node without typecheck
MIT License
1.76k stars 73 forks source link

Compiler options conversion fails if extending from a tsconfig in a separate monorepo package #639

Open osdiab opened 2 years ago

osdiab commented 2 years ago

I use Turborepo for my monorepo. It defaults to having a single yarn workspace module for shared TSConfigs.

So a sub-package that uses swc-node has a tsconfig.json that extends another tsconfig.json file, except that file lives in a separate sub-package, and is resolved via the node module system. This works for tsc, but it doesn't work for swc-node; if i run SWC_NODE_PROJECT=./tsconfig.json node -r @swc-node/register path/to/script then I get the error Convert compiler options from json failed, File 'tsconfig/base' not found. where tsconfig is the name of the submodule containing the root TSConfig.

I'll link to a repro repo soon, but I think this more or less captures the issue.