Plotly htmlwidgets capture parent environments in closures, causing 60-80x size inflation when serialized via saveRDS/targets. This function runs plotly_build() to resolve lazy data, then replaces closure environments with emptyenv() to eliminate the bloat.
See also
Other utilities:
create_summary_table(),
example_data(),
export_h5ad(),
format_file_size(),
format_with_commas(),
gene_report()
Examples
if (FALSE) { # \dontrun{
p <- plotly::plot_ly(mtcars, x = ~mpg, type = "histogram")
object.size(p) # large
p2 <- strip_plotly(p)
object.size(p2) # small
} # }