Skip to main content

parse_sync

Function parse_sync 

Source
pub fn parse_sync(
    filename: String,
    source_text: String,
    options: Option<ParserOptions>,
) -> ParseResult
Expand description

Parse JS/TS source synchronously on current thread.

This is generally preferable over parse (async) as it does not have the overhead of spawning a thread, and the majority of the workload cannot be parallelized anyway (see parse documentation for details).

If you need to parallelize parsing multiple files, it is recommended to use worker threads with parseSync rather than using parse.