Skip to content

Lighter dependencies #2

Open
Open
@matheus23

Description

@matheus23

Currently, tracing-subscriber-wasm is already fairly light on dependencies (only 3), but it could be a lot lighter in transitive dependencies.

It seems like you're pulling in gloo for only these lines of code:

use gloo::console;
use tracing::Level;
let data = std::str::from_utf8(&self.1).map_err(|_| {
io::Error::new(io::ErrorKind::InvalidData, "data not UTF-8")
})?;
match self.0 {
Level::TRACE => console::debug!(data),
Level::DEBUG => console::debug!(data),
Level::INFO => console::log!(data),
Level::WARN => console::warn!(data),
Level::ERROR => console::error!(data),
}
Ok(())

But because you're using gloo with all default features:

[dependencies]
gloo = "0.8"

You're pulling in other things like gloo-timers, gloo-render etc. in, too.

Some good options might be

  • turning off default feature flags on gloo, and only turning on the console feature flag
  • replacing the gloo dependency with gloo-console
  • replacing the gloo dependency with custom wasm-bindgen bindings to the global console object (essentially vendoring the code needed from gloo-console)

The first two options might be the best ones from an effort/payoff perspective.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions