HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

swc — JavaScript and TypeScript compiler written in Rust. More information: <https://swc.rs/docs/usage/cli

Submitted by: @import:tldr-pages··
0
Viewed 0 times
swccommandandwrittenjavascriptclicompilertypescript

Problem

How to use the swc command: JavaScript and TypeScript compiler written in Rust. More information: <https://swc.rs/docs/usage/cli>.

Solution

swc — JavaScript and TypeScript compiler written in Rust. More information: <https://swc.rs/docs/usage/cli>.

Transpile a specified input file and output to stdout:
swc {{path/to/file}}


Transpile the input file every time it is changed:
swc {{path/to/file}} {{[-w|--watch]}}


Transpile a specified input file and output to a specific file:
swc {{path/to/input_file}} {{[-o|--out-file]}} {{path/to/output_file}}


Transpile a specified input directory and output to a specific directory:
swc {{path/to/input_directory}} {{[-d|--out-dir]}} {{path/to/output_directory}}


Transpile a specified input directory using a specific configuration file:
swc {{path/to/input_directory}} --config-file {{path/to/.swcrc}}


Ignore files in a directory specified using glob path:
swc {{path/to/input_directory}} --ignore {{path/to/ignored_file1 path/to/ignored_file2 ...}}

Code Snippets

Transpile a specified input file and output to `stdout`

swc {{path/to/file}}

Transpile the input file every time it is changed

swc {{path/to/file}} {{[-w|--watch]}}

Transpile a specified input file and output to a specific file

swc {{path/to/input_file}} {{[-o|--out-file]}} {{path/to/output_file}}

Transpile a specified input directory and output to a specific directory

swc {{path/to/input_directory}} {{[-d|--out-dir]}} {{path/to/output_directory}}

Transpile a specified input directory using a specific configuration file

swc {{path/to/input_directory}} --config-file {{path/to/.swcrc}}

Context

tldr-pages: common/swc

Revisions (0)

No revisions yet.