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 cannot build "chart.js" #52

Open
1 of 2 tasks
pan93412 opened this issue Sep 17, 2024 · 1 comment
Open
1 of 2 tasks

SWC cannot build "chart.js" #52

pan93412 opened this issue Sep 17, 2024 · 1 comment

Comments

@pan93412
Copy link
Contributor

pan93412 commented Sep 17, 2024

The upstream bug is: swc-project/swc#9559

$ '/Volumes/Dev/ResearchProject/lets-php/app-sf/var/swc-darwin-arm64' 'compile' 'assets' '--out-dir' '/Volumes/Dev/ResearchProject/lets-php/app-sf/var/typescript' '--config-file' '.swcrc'
Error: Failed to open file assets/vendor/chart.js

Caused by:
    Is a directory (os error 21)
@pan93412 pan93412 changed the title SWC cannot build "chart.js" well SWC cannot build "chart.js" Sep 17, 2024
pan93412 added a commit to database-playground/app-sf that referenced this issue Sep 17, 2024
A bug in SWC[^1] makes the compilation of TypeScript fail. I migrated the TypeScript code back to JavaScript (with @ts-check and JSDoc comments) to eliminate the need for compilation.

Besides, `tsconfig.json` are renamed to `jsconfig.json` and exclude some JS files that should not be checked.

[^1]: sensiolabs/AssetMapperTypeScriptBundle#52
pan93412 added a commit to database-playground/app-sf that referenced this issue Sep 17, 2024
A bug in SWC[^1] makes the compilation of TypeScript fail. I migrated the TypeScript code back to JavaScript (with @ts-check and JSDoc comments) to eliminate the need for compilation.

Besides, `tsconfig.json` are renamed to `jsconfig.json` and exclude some JS files that should not be checked.

[^1]: sensiolabs/AssetMapperTypeScriptBundle#52
@pan93412
Copy link
Contributor Author

Found a simple workaround – just move the files to build to a separate folder:

CleanShot 2024-09-17 at 22 52 37@2x

sensiolabs_typescript:
  source_dir:
    - "%kernel.project_dir%/assets/app"
    - "%kernel.project_dir%/assets/controllers"
  swc_version: v1.7.26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant