Protocol Buffer loader module for webpack. Supports protobufjs v6+
npm install proto-loader6Converts .proto files into JSON so they can be loaded without a parser. For use with webpack and ProtoBuf.js
`` javascript
var protobuf = require('protobufjs');
var protoDefinition = require('json!proto!./message.proto');
// => returns json object converted from message.proto, resolves imports
var root = protobuf.Root.fromJSON(protoDefinition);
//...
`
` javascript`
module.exports = {
module: {
loaders: [
{
test: /\.proto$/,
loaders: ['json-loader', "proto-loader"]
}
]
}
};
Then you only need to write: require("./message.proto")
```
webpack
node ./out/bundle.js