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 does not transpile on Windows if tsconfig.json is present in cwd where the cmd is ran #758

Closed
c3cris opened this issue Feb 23, 2024 · 3 comments

Comments

@c3cris
Copy link

c3cris commented Feb 23, 2024

Steps to reproduce

Files

test.ts
const hello : string = "World";
tsconfig.json ( even empty file )
{}

Libs and Versions

tested with
@swc-node/register: 1.6 or 1.8 as well
and with node 18.17 and 20.11

Reproduce

run command
node --loader @swc-node/register/esm .\test.ts
What happens:

const hello : string = "World";
      ^^^^^
SyntaxError: Missing initializer in const declaration

Expected:
no errors

Remove tsconfig.json file and run the command again

node --loader @swc-node/register/esm .\test.ts

Result:
no errors

Side note

If you have the test.js and tsconfig.json file in a subfolder and run the command from parent folder where tsconfig.json is not present it will run.

pwd = testproject
src
|--- test.ts
|---tsconfig.json

It works if you run the command from one directory up if tsconfig.json isn't present in the folder you run the cmd
node --loader @swc-node/register/esm .\src\test.ts
Result:
no errors

@c3cris
Copy link
Author

c3cris commented Feb 23, 2024

I think this might be relevant #754

@yeliex
Copy link
Contributor

yeliex commented Mar 4, 2024

#754 should fixed this. please test and feedback

@c3cris
Copy link
Author

c3cris commented Mar 6, 2024

Ok, I will, thank you.

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

No branches or pull requests

3 participants