swc-node respects the files and includes properties of tsconfig, which is normally sensible but interferes with monorepo workflows that depend on directly importing typescript files from sibling packages.
The Motivation
I've been using swc-node alongside a small HMR package I built for node as a lightning-fast alternative to ts-node-dev for the last couple months. It's made for a great development workflow, with the small exception that setup is a bit clunkier than it needs to be. Because @swc-node/register respects the files and includes properties of tsconfig, it refuses to transform TS files outside of the project directory when it encounters them. I found experimentally that removing includes and setting files to [] causes swc-node to default to a compile-everything state, which is perfect for my monorepo development flow.
Unfortunately, all of my other tooling requires those properties to be set in order to associate the tsconfig file to them.
Desired Behavior
A flag or alternate entrypoint (e.g. @swc-node/register-wildcard) to explicitly opt into the "compile every TS file I come across" behavior that automatically applies when files is set to an empty array.
Existing Workaround
Create a tsconfig.swc.json which overwrites files and invoke node via SWC_NODE_PROJECT='./tsconfig.swc.json' node -r @swc-node/register ./src/index.ts:
The Problem
swc-node respects the
files
andincludes
properties of tsconfig, which is normally sensible but interferes with monorepo workflows that depend on directly importing typescript files from sibling packages.The Motivation
I've been using swc-node alongside a small HMR package I built for node as a lightning-fast alternative to ts-node-dev for the last couple months. It's made for a great development workflow, with the small exception that setup is a bit clunkier than it needs to be. Because
@swc-node/register
respects thefiles
andincludes
properties of tsconfig, it refuses to transform TS files outside of the project directory when it encounters them. I found experimentally that removingincludes
and settingfiles
to[]
causes swc-node to default to a compile-everything state, which is perfect for my monorepo development flow.Unfortunately, all of my other tooling requires those properties to be set in order to associate the tsconfig file to them.
Desired Behavior
A flag or alternate entrypoint (e.g.
@swc-node/register-wildcard
) to explicitly opt into the "compile every TS file I come across" behavior that automatically applies whenfiles
is set to an empty array.Existing Workaround
Create a
tsconfig.swc.json
which overwritesfiles
and invoke node viaSWC_NODE_PROJECT='./tsconfig.swc.json' node -r @swc-node/register ./src/index.ts
:If you believe this feature makes sense as part of @swc-node, I'd be happy to get a PR together for you.