Skip to content
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

@swc/core's binary does not handle folders with .js suffix well #9559

Closed
pan93412 opened this issue Sep 17, 2024 · 1 comment · Fixed by #9560
Closed

@swc/core's binary does not handle folders with .js suffix well #9559

pan93412 opened this issue Sep 17, 2024 · 1 comment · Fixed by #9560
Assignees
Labels
Milestone

Comments

@pan93412
Copy link
Contributor

pan93412 commented Sep 17, 2024

Describe the bug

I found that SWC mistakenly treats a folder with the .js suffix as a file, which introduces this bug:

$ ./swc-darwin-arm64-1.7.26 compile .
Error: Failed to open file ./vendor/chart.js

Caused by:
    Is a directory (os error 21)

Note that the binary is downloaded from the GitHub Releases:

wget https://github.com/swc-project/swc/releases/download/v1.7.26/swc-darwin-arm64 -O swc-darwin-arm64-1.7.26 && chmod +x swc-darwin-arm64-1.7.26

Input code

No response

Config

No response

Playground link (or link to the minimal reproduction)

https://github.com/pan93412/swc-minimum-repro

SWC Info output

    Operating System:
        Platform: darwin
        Arch: arm64
        Machine Type: arm64
        Version: Darwin Kernel Version 24.0.0: Mon Aug 12 20:52:41 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T6031
        CPU: (16 cores)
            Models: Apple M3 Max

    Binaries:
        Node: 20.17.0
        npm: 10.8.2
        Yarn: N/A
        pnpm: N/A

    Relevant Packages:
        @swc/core: N/A
        @swc/helpers: N/A
        @swc/types: N/A


    SWC Config:
        output: N/A
        .swcrc path: N/A

    Next.js info:
        output: N/A

Expected behavior

It should be able to build. For example, when I rename chart.js to charts:

$ mv vendor/chart.js/ vendor/chartjs

$ ./swc-darwin-arm64-1.7.26 compile .
./vendor/chartjs/chart.js.min.js
console.log("hi chart.js");

./index.ts
console.log("Hello");

Actual behavior

$ mv vendor/chartjs vendor/chart.js

$ ./swc-darwin-arm64-1.7.26 compile .
Error: Failed to open file ./vendor/chart.js

Caused by:
    Is a directory (os error 21)

Version

1.7.26

Additional context

No response

@swc-bot
Copy link
Collaborator

swc-bot commented Oct 24, 2024

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

3 participants