Skip to main content

source_is_es_module

Function source_is_es_module 

Source
pub fn source_is_es_module(source: &str) -> bool
Expand description

Heuristic: the source begins a line with a static import/export and so must run as an ES module (bundled). Dynamic import(...) is intentionally NOT matched — it is valid in a plain script, so such a script keeps top-level return. A false positive only costs an unnecessary bundle, never wrong output.