swc
swc copied to clipboard
--out-dir drops the first directory when transpiling nested directories
Describe the bug
When running swc
on a set of files that have subdirectories, swc
always drops the first nested directory in its outputs.
Input code
swc --no-swcrc a.ts b/b.ts c/c/c.ts --out-dir outputs
Config
No response
Playground link
No response
Expected behavior
Say that I have the following directory structure:
.
├── a.ts
├── b
│ └── b.ts
└── c
└── c
└── c.ts
I'd expect the following directory structure to be produced by swc:
outputs
├── a.js
├── b
│ └── b.js
└── c
└── c
└── c.js
Both the TypeScript compiler and Babel properly produce the expected directory structure.
Actual behavior
but the following is produced:
outputs
├── a.js
├── b.js
└── c
└── c.js
Version
@swc/cli: 0.1.57, @swc/core: 1.2.129
Additional context
No response
dupe of https://github.com/swc-project/swc/issues/3028 I think
Yeah looks like I'm reporting the same behavior, but what we expect the flag to do is different (I expect to keep the directory structure whereas that issue expects to completely flatten it)
Same problems !
+1 here. This is the only thing stopping me from adopting swc.
@swc/cli: 0.1.59, @swc/core: 1.3.26
also experiencing this issue and also having this be the only blocker from my adoption of SWC
@swc/core v1.3.61,@swc/cli v0.1.62
This is especially a problem when c/c/c.ts
has import from '../../a'
, because then the import has an extra ../
making it import from the source rather than the outputs directory.