Skip to content

Reduce compiled JS file size #270

@stanley-cheung

Description

@stanley-cheung

As it stands, our npm package index.js is 218KiB (which is being compiled by the closure compiler here).

With the Echo example echo.proto, that has about 7 message types, 1 service, 3 unary methods and 5 streaming methods:

  • The Closure example final compiled.js compiled by the Closure compiler: 317KiB
  • The CommonJS example final dist/main.js compiled by webpack: 415KiB
  • The same CommonJS example compiled by browserify: 479KiB
  • The CommonJS example with .d.ts typings generated, and then compiled by webpack: 499KiB

I tried babel-minify and uglify-js on some of these JS files and the output are not any particularly smaller.

There should be some other things we can do to further minimize the compiled JS code size.

Reference: #79

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