Protocol Buffer loader module for webpack
Converts .proto files into JSON so they can be loaded without a parser. For use with webpack and ProtoBuf.js
Installation
npm install proto-loader
Usage
Documentation: Using loaders
var ProtoBuf = require('protobufjs/dist/protobuf-light');
var protoDefinition = require('proto!./message.proto');
var builder = ProtoBuf.loadJson(protoDefinition);
webpack config
module.exports = {
module: {
loaders: [
{
test: /\.proto$/,
loader: "proto-loader"
}
]
}
};
Then you only need to write: require("./message.proto")
License
MIT (http://www.opensource.org/licenses/mit-license.php)