Open c3cris opened 4 months ago
test.ts const hello : string = "World"; tsconfig.json ( even empty file ) {}
const hello : string = "World";
{}
tested with @swc-node/register: 1.6 or 1.8 as well and with node 18.17 and 20.11
@swc-node/register: 1.6 or 1.8 as well
18.17 and 20.11
run command node --loader @swc-node/register/esm .\test.ts What happens:
node --loader @swc-node/register/esm .\test.ts
const hello : string = "World"; ^^^^^ SyntaxError: Missing initializer in const declaration
Expected: no errors
no errors
tsconfig.json
Result: no errors
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
node --loader @swc-node/register/esm .\src\test.ts
I think this might be relevant #754
Ok, I will, thank you.
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 node18.17 and 20.11
Reproduce
run command
node --loader @swc-node/register/esm .\test.ts
What happens:Expected:
no errors
Remove
tsconfig.json
file and run the command againnode --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.
It works if you run the command from one directory up if
tsconfig.json
isn't present in the folder you run the cmdnode --loader @swc-node/register/esm .\src\test.ts
Result:no errors