Skip to main content

inline_source_map_comment

Function inline_source_map_comment 

Source
pub fn inline_source_map_comment(
    original_path: &str,
    original_content: &str,
) -> String
Expand description

Generates an inline source map comment that maps back to the original file in a trivial way

This is useful for source transforms that convert non-JS files (like text or binary files) into ES modules. The inline source map ensures that debuggers and error stacks show the original file path rather than the generated code.

§Arguments

  • original_path - The path to the original file (used in source map’s “sources” field)
  • original_content - The original file content (used in source map’s “sourcesContent” field)

§Returns

An inline source map comment (e.g., //# sourceMappingURL=data:application/json;base64,...)