Skip to content

Basically does not tree shake at all #115

@KTibow

Description

@KTibow

I was investigating my bundle and dependency graph, and I found that this package was taking up a sizable portion. It turns out that even if you use nothing from this package - that is, import "@peculiar/x509" - it still takes almost 200kb!

Some of this is inherent to dependency injection. My tip is that you should avoid dependency injection where it's not needed, and where it's needed, you can explicitly mark it as pure by doing this:

const v = /* @__PURE__ */ (() => {
  console.log("impure code");
  return "value";
})();

so the code can be discarded if its resulting value/class/whatever is unused.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions