Skip to content

Encoder-only code still contains writer import #712

@joscha

Description

@joscha

protobuf.js version: 6.6.5

When using the CLI with these options:

pbjs \
    --target=static-module \
    --wrap commonjs \
    --no-create \
    --no-encode \
    --no-verify \
    --no-convert \
    --no-delimited \
    --out decoder.js \
    ./my.proto

I expect to end up with a file that only contains references to anything that is needed to decode messages, however the file ends up having an unused reference to $protobuf.Writer:

// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;

I searched a bit in the code and could not actually find the place where it calculates the needed dependencies. If you point me in the right direction I am happy to contribute a fix.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions