小编Jum*_*eur的帖子

如何设置SWC编译器

我是第一次使用SWC,无法将 ts 文件编译为普通的 js 文件。

当我运行命令时:

npx swc ./src -d dist
Run Code Online (Sandbox Code Playgroud)

我收到错误:

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
Run Code Online (Sandbox Code Playgroud)

这是我用SWC Playground生成的 my.swcrc

npx swc ./src -d dist
Run Code Online (Sandbox Code Playgroud)

我的目标是:

  • ./src从我的目录中获取我的 ts 文件
  • 编译并将其输出到dist启用源映射的目录中

node.js typescript swc-compiler

6
推荐指数
0
解决办法
2773
查看次数

标签 统计

node.js ×1

swc-compiler ×1

typescript ×1