gRPC loader module for webpack
Converts .proto files into autogenerated js files for use with gRPC
Installation
yarn add --dev grpc-loader
Usage
static: true
You can ignore protobufjs
peer dependency if you use this option.
P.S. I don't really like this api. It's too verbose. google-protobuf
const proto = require('./test.proto');
console.log(proto);
static: false
You can ignore google-protobuf
peer dependency if you use this option.
same as grpc.load
you can also pass any properties that grpc.load
accepts
const proto = require('./test.proto');
console.log(proto);
For usage checkout test
folder
Test
npm run test
webpack config
module.exports = {
module: {
rules: [
{
test: /\.proto$/,
loader: 'grpc-loader',
options: {
static: false,
},
}
]
}
};
License
MIT (http://www.opensource.org/licenses/mit-license.php)