Skip to content

Unnecessary dependencies  #343

@prevostc

Description

@prevostc

Hi,

I've been using this lib with great success on AWS lambda.
My main issue is the generated package size which is quite important for a lambda function (faster code uploads + faster js parsing = less money spent)

With a webpack builder and a default config, a simple lambda that only jwt.verify some token comes at a whopping 741.64 Kb

  • 113.93 Kb of Joi
  • 62.78 Kb of isemail (dependency of joi ?)
  • 455.55 Kb of moment (definitely a dependency of Joi)
  • other small stuff

As I don't care about moment locales, I removed them with new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/).

The final jsonwebtoken package size is 412.01 Kb

  • 113.93 Kb of Joi
  • 62.78 Kb of isemail (dependency of joi ?)
  • 221.42Kb of moment (definitely a dependency of joi)
  • other small stuff

I do not know much about this project but it doesn't seem to need the full power of joi and moment. Joi is only used in sign.js and you could gain a lot by just getting rid of joi altogether.

That being said, it's just a suggestion because anyone could exclude unwanted dependencies with webpack, but it's a nice default to have.

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