npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

grpc-webpack-plugin

v0.2.79

Published

A webpack plugin that compiles .proto files automatically with gRPC-Web.

Readme

Notice: Make sure you have protoc and protoc-gen-grpc-web installed on your OS.

npm i --save-dev grpc-webpack-plugin
yarn add --dev grpc-webpack-plugin

webpack.config.js

const GrpcWebPlugin = require('grpc-webpack-plugin');

const path = require('path');
const DIR = path.resolve(__dirname, './protos');
const OUT_DIR = path.resolve(__dirname, './generated');

module.exports = {
  mode: 'development',
  plugins: [
    // Proto messages
    new GrpcWebPlugin({
      protoPath: DIR,
      protoFiles: ['echo.proto'],
      outputType: 'js',
      importStyle: 'commonjs',
      binary: true,
      outDir: OUT_DIR,
    }),
    // Service client stub
    new GrpcWebPlugin({
      protoPath: DIR,
      protoFiles: ['echo.proto'],
      outputType: 'grpc-web',
      importStyle: 'commonjs+dts',
      mode: 'grpcwebtext',
      outDir: OUT_DIR,
    }),
  ],
  // In addition, you can debug your options by adding the following configuration
  // Require webpack>=4.37
  infrastructureLogging: {
    level: 'error',
    debug: /GrpcWebPlugin/,
  },
});

|Name|Description|Type|Default| |:--:|-----------|:--:|:-----:| |protoPath|Required, e.g. './protos'|{String}| | |protoFiles|Required, e.g. ['foo.proto', 'bar.proto']|{Array.<string>}| | |outputType|Required, 'js' \| 'grpc-web'|{String}| | |importStyle|'closure' \| 'commonjs' \| 'commonjs+dts' \| 'typescript', see Import Style|{String}|'closure'| |binary|Enable it to serialize and deserialize your proto from the protocol buffers binary wire format|{Boolean}|false| |mode|'grpcwebtext' \| 'grpcweb', see Wire Format Mode|{String}|'grpcwebtext'| |outDir| |{String}|'.'| |extra|Other protoc options, see protoc -h|{Array.<string>}|[]| |synchronize|Sync generated codes with .proto files each time you run webpack, disable it if you want to keep your generated codes read-only|{Boolean}|true| |watch|Watch .proto files and recompile whenever they change. Only works if synchronize is true. (Need to turn on webpack watch mode first)|{Boolean}|true|

Notice: commonjs+dts and typescript importStyle only works with grpc-web outputType.

You can compile multiple .proto files and put the generated code into separate folders like this:

webpack.config.js

module.exports = {
  plugins: [
    ...['foo', 'bar', 'baz'].map(
      protoName =>
        new GrpcWebPlugin({
          protoPath: path.resolve(__dirname, './protos'),
          protoFiles: [`${protoName}.proto`],
          outputType: 'grpc-web',
          importStyle: 'typescript',
          mode: 'grpcwebtext',
          outDir: path.join(__dirname, 'generated', protoName),
        })
    ),
  ],
};
  • [ ] Add some hooks
  • [ ] Support Webpack 5