Skip to content

Protocol Buffer loader module for webpack. Supports protobufjs v6+

Notifications You must be signed in to change notification settings

cessationoftime/proto-loader6

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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');

var protoDefinition = require('json!proto-loader6!./message.proto');
// => returns json object converted from message.proto, resolves imports

var root = protobuf.Root.fromJSON(protoDefinition);
//...

webpack config

module.exports = {
  module: {
    loaders: [
      {
        test: /\.proto$/,
        loaders: ['json-loader', "proto-loader6"]
      }
    ]
  }
};

Then you only need to write: require("./message.proto")

Run example with

webpack
node ./out/bundle.js

License

MIT (http://www.opensource.org/licenses/mit-license.php)

About

Protocol Buffer loader module for webpack. Supports protobufjs v6+

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%