Skip to main content

Sucrase

Sucrase is a super-fast alternative to Babel for when you can target modern JS runtimes.

Language Info

Name

sucrase

Extension

.sucrase

Editor

script

Compiler

The official Sucrase compiler.

Version

sucrase: v3.32.0

Custom Settings

Custom settings added to the property sucrase are passed as a JSON object to the transform function during compile. Please check the documentation for full reference.

By default, the following transforms are enabled: ['jsx', 'typescript']

Please note that custom settings should be valid JSON (i.e. functions are not allowed).

Example:

{
"sucrase": { "transforms": ["typescript", "imports"] }
}

Example Usage

show code
import { createPlayground } from 'livecodes';

const options = {
"params": {
"sucrase": "export const Greet = (name: string) => <>Hello {name}!</>;",
"compiled": "open"
}
};
createPlayground('#container', options);