Skip to content

Commit

Permalink
update readme to add webpack loader pbf-loader to require .proto files (
Browse files Browse the repository at this point in the history
  • Loading branch information
btiwaree authored and mourner committed Feb 2, 2017
1 parent 21d51b2 commit bc2da8f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ var proto = schema.parse(fs.readFileSync('example.proto'));
var Test = compile(proto).Test;
```

If you use `webpack` as your module bundler, you can use [pbf-loader](https://github.com/trivago/pbf-loader)
to load .proto files directly. It returns a compiled module ready to be used.

Given you already configured your `webpack.config.js`, the code above would look like:
```js
var Pbf = require('pbf');
var proto = require('./example.proto');

var Test = proto.Test;
```

#### Custom Reading

```js
Expand Down

0 comments on commit bc2da8f

Please sign in to comment.