swc-project / swc-project/swc-node
[request] Consider adding an option to ignore `files` / `includes` property of tsconfig
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 95
- Avg merge
- 14d 11h
- Merged PRs (30d)
- 1
Description
The Problem
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:
// tsconfig.swc.json
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./tsconfig.json",
"files": []
}
If you believe this feature makes sense as part of @swc-node, I'd be happy to get a PR together for you.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the @swc-node/register entrypoint and the proposed tsconfig.swc.json workaround to understand how files and includes currently affect transformation. Define an opt-in flag or alternate entrypoint that compiles encountered TypeScript files outside the project configuration, while preserving the existing behavior by default.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100