-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli
: Pathing under --out-dir has extra segments
#3028
Comments
I also encountered the same problem |
Can I work on this, @kdy1? |
Of course, thank you! |
cli
: Pathing under --out-dir has extra segments
Just ran into this as well. The expected output is consistent with how Babel handles the same command but the extra directories are definitely being generated unexpectedly. @ruiconti @kdy1 has there been any headway on this one? i feel like this is a pretty large issue and causes extra code to have to be written to re-copy all the output into the expected dir and remove the extra generated dirs manually. |
I think I have the same issue. I'm building a component library for one of my projects and I have the component files under As a temporary fix I'm compiling everything in the root directory and then renaming the output // package.json
{
... stuff ...
"sripts": {
... other stuff ...
"build": "yarn clean && yarn build:js && yarn build:types",
"build:js": "npx swc ./src/components -d ./ && mv ./components ./dist",
"build:types": "tsc --emitDeclarationOnly --declaration --outDir ./dist",
"clean": "rm -rf ./dist"
},
... more stuff ...
}
|
We are using this logic to create a workaround at the moment: const firstSegmentIndex = srcPath.indexOf('/');
if (firstSegmentIndex !== -1) {
// TODO remove this when https://github.com/swc-project/swc/issues/3028 is fixed
destPath = destPath.slice(0, -srcPath.length + firstSegmentIndex);
} Which changes this:
to
|
|
@Dinhero21 Please see swc-project/cli#281 |
Describe the bug
When the input directory has multiple segments, swc appears to strip only the first. Remaining segments appear in the output tree, making it more nested than expected.
Example:
I don't think we expected the repeated
path/path
part of that resulting output directory.Note, under bazel this results in output directories like
bazel-bin/examples/directory/minify/k8-fastbuild/bin/examples/directory/split_app/file1.js
Input code
No response
Config
No response
Playground link
No response
Expected behavior
I would have expected that example to write output to
some/other/path/file.js
Version
@swc/cli: 0.1.53 @swc/core: 1.2.119
Additional context
No response
The text was updated successfully, but these errors were encountered: