I'm using SWC for the first time and I'm not able to compile my ts files into normal js files.
When I run my command :
npx swc ./src -d dist
I got the error :
failed to process js file
Caused by:
0: failed to read swcrc file (src/index.ts)
1: failed to deserialize .swcrc (json) file: syntax error: 1:1
2: expected value at line 1 column 1
Here is my.swcrc I have generated with the SWC Playground
{
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": false
},
"loose": false,
"minify": {
"compress": false,
"mangle": false
}
},
"module": {
"type": "commonjs"
},
"minify": false,
"isModule": true,
"sourceMaps": "inline"
}
My goal is to :
- Take my ts files from my
./src
dir - Compile and output it in a
dist
dir with source maps enabled