protobufjs-loader
Webpack loader to translate
protobuf definitions to
ProtoBuf.js
modules. Equivalent to running your definitions through the pbjs
CLI.
This allows you to use the light or minimal ProtoBuf.js distributions
without an explicit compile step in your build pipeline.
Install
npm install --save-dev protobufjs-loader-webpack4
Usage
module.exports = {
...
module: {
rules: [{
test: /\.proto$/,
use: {
loader: 'protobuf-preloader',
options: {
json: true,
paths: ['/path/to/definitions'],
pbjsArgs: ['--no-encode']
}
}
}]
}
};
const Root = require('my/protobuf.proto');